import { Consumer, Observer } from "./frp-common"; import { Behavior } from "./Behavior"; /** * A future is a thing that occurs at some point in time with a value. * It can be understood as a pair consisting of the time the future * occurs and its associated value. It is quite like a JavaScript * promise. */ export declare abstract class Future implements Consumer { occured: boolean; value: A; protected listeners: Consumer[]; constructor(); listen(o: Consumer): void; subscribe(f: (a: A) => void): void; abstract push(val: any): void; resolve(val: A): void; map(f: (a: A) => B): Future; mapTo(b: B): Future; static of(b: B): Future; of(b: B): Future; static lift(f: (t: T1) => R, m: Future): Future; static lift(f: (t: T1, u: T2) => R, m1: Future, m2: Future): Future; static lift(f: (t1: T1, t2: T2, t3: T3) => R, m1: Future, m2: Future, m3: Future): Future; chain(f: (a: A) => Future): Future; } export declare function sink(): Future; export declare function fromPromise(p: Promise): Future; /** * Create a future from a pushing behavior. The future occurs when the * behavior pushes its next value. Constructing a BehaviorFuture is * impure and should not be done direcly. * @private */ export declare class BehaviorFuture extends Future implements Observer { private b; constructor(b: Behavior); endPulling(): void; beginPulling(): void; push(a: A): void; } export declare const of: typeof Future.of; export declare const lift: typeof Future.lift;