UNPKG

@fable-org/fable-library-js

Version:

Core library used by F# projects compiled with fable.io

27 lines (26 loc) 2.53 kB
import { Continuation, Continuations } from "./AsyncBuilder.js"; import { Async, IAsyncContext, CancellationToken } from "./AsyncBuilder.js"; import { FSharpChoice$2_$union } from "./Choice.js"; export declare function makeAsync<T>(body: Async<T>): Async<T>; export declare function invoke<T>(computation: Async<T>, ctx: IAsyncContext<T>): void; export declare function callThenInvoke<T, U>(ctx: IAsyncContext<T>, result1: U, part2: (x: U) => Async<T>): void; export declare function bind<T, U>(ctx: IAsyncContext<T>, part1: Async<U>, part2: (x: U) => Async<T>): void; export declare function createCancellationToken(arg?: boolean | number): CancellationToken; export declare function cancel(token: CancellationToken): void; export declare function cancelAfter(token: CancellationToken, ms: number): void; export declare function isCancellationRequested(token: CancellationToken): boolean; export declare function throwIfCancellationRequested(token: CancellationToken): void; export declare function startChild<T>(computation: Async<T>, ms?: number): Async<Async<T>>; export declare function awaitPromise<T>(p: Promise<T>): (ctx: IAsyncContext<T>) => void; export declare function cancellationToken(): (ctx: IAsyncContext<CancellationToken>) => void; export declare const defaultCancellationToken: CancellationToken; export declare function catchAsync<T>(work: Async<T>): (ctx: IAsyncContext<FSharpChoice$2_$union<T, Error>>) => void; export declare function fromContinuations<T>(f: (conts: Continuations<T>) => void): (ctx: IAsyncContext<T>) => void; export declare function ignore<T>(computation: Async<T>): (ctx: IAsyncContext<undefined>) => void; export declare function parallel<T>(computations: Iterable<Async<T>>): (ctx: IAsyncContext<Awaited<T>[]>) => void; export declare function sequential<T>(computations: Iterable<Async<T>>): (ctx: IAsyncContext<T[]>) => void; export declare function sleep(millisecondsDueTime: number): (ctx: IAsyncContext<void>) => void; export declare function start<T>(computation: Async<T>, cancellationToken?: CancellationToken): void; export declare function startImmediate<T>(computation: Async<T>, cancellationToken?: CancellationToken): void; export declare function startWithContinuations<T>(computation: Async<T>, continuation: Continuation<T>, exceptionContinuation: Continuation<any>, cancellationContinuation: Continuation<any>, cancelToken?: CancellationToken): void; export declare function startAsPromise<T>(computation: Async<T>, cancellationToken?: CancellationToken): Promise<T>;