UNPKG

resig.js

Version:

Universal reactive signal library with complete platform features: signals, animations, CRDTs, scheduling, DOM integration. Works identically across React, SolidJS, Svelte, Vue, and Qwik.

45 lines (44 loc) 1.31 kB
/** * Time Algebra - Clock ticks and temporal operations * Extends Effect with time-based operations */ import { Effect } from '../core/effect'; export interface Time<A> extends Effect<A> { readonly delay: (ms: number) => Time<A>; readonly timeout: (ms: number) => Time<A | Error>; readonly interval: (ms: number) => Time<A>; readonly now: () => A; readonly update: () => void; } /** * Creates a Time effect with temporal operations */ export declare const time: <A>(initial: A) => Time<A> & { _set: (value: A) => void; }; /** * Creates a current time effect that updates with the current timestamp */ export declare const currentTime: () => Time<number> & { _set: (value: number) => void; }; /** * Creates a delayed effect */ export declare const delay: <A>(ms: number, value: A) => Time<A>; /** * Creates a timeout effect */ export declare const timeout: <A>(ms: number, effect: Effect<A>) => Time<A | Error>; /** * Creates an interval effect */ export declare const interval: <A>(ms: number, value: A) => Time<A>; /** * Debounce utility using Time algebra */ export declare const debounce: <A>(ms: number, effect: Effect<A>) => Time<A>; /** * Throttle utility using Time algebra */ export declare const throttle: <A>(ms: number, effect: Effect<A>) => Time<A>;