state-switch
Version:
State Switch is a Change Monitor/Guarder for Async Actions.
20 lines • 820 B
TypeScript
import type TypedEventEmitter from 'typed-emitter';
/**
* Using Three Valued Logic for ON/OFF State
* https://github.com/huan/state-switch/issues/1
*
* Three-valued Logic (3VL): `true`, `false`, and
* 'pending': it's in process, not stable.
*/
declare type Pending = 'pending';
export declare type ActiveListener = (state: true | Pending) => void | Promise<void>;
export declare type InactiveListener = (state: true | Pending) => void | Promise<void>;
interface StateSwitchEventListener {
active: ActiveListener;
inactive: InactiveListener;
}
declare const StateSwitchEventEmitter: new () => TypedEventEmitter<StateSwitchEventListener>;
declare type StateType = keyof StateSwitchEventListener;
export type { Pending, StateType, };
export { StateSwitchEventEmitter, };
//# sourceMappingURL=events.d.ts.map