-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtypes.ts
61 lines (52 loc) · 1.98 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { Result } from '@stopify/continuations-runtime';
export { Result };
export { HandleNew, CaptureMethod, CompilerOpts } from '@stopify/continuations';
import * as t from 'babel-types';
export type Stoppable = (isStop: () => boolean,
onStop: () => void,
onDone: () => void,
opts: RuntimeOpts) => void;
export type ElapsedTimeEstimatorName = 'exact' | 'reservoir' | 'velocity' | 'interrupt' | 'countdown';
export interface RuntimeOpts {
filename: string,
estimator: ElapsedTimeEstimatorName;
yieldInterval: number,
resampleInterval: number,
timePerElapsed: number,
stop: number | undefined,
variance: boolean,
stackSize: number,
restoreFrames: number,
/** These are strings that Selenium recognizes, which is why it says
* 'MicrosoftEdge' instead of 'edge'.
*/
env: 'firefox' | 'chrome' | 'node' | 'MicrosoftEdge' | 'safari'
}
export type Error = {
kind: 'error',
exception: any
}
export interface AsyncEval {
evalAsyncFromAst(ast: t.Program, onDone: (result: Result) => void): void;
evalAsync(src: string, onDone: (result: Result) => void): void;
}
export interface AsyncRun {
kind : 'ok',
g: { [key: string]: any},
run(onDone: (result: Result) => void,
onYield?: () => void,
onBreakpoint?: (line: number) => void): void;
pause(onPaused: (line?: number) => void): void;
resume(): void;
isRunning(): boolean;
setBreakpoints(line: number[]): void;
step(onStep: (line: number) => void): void;
pauseK(callback: (k: (r: Result) => void) => void): void;
pauseImmediate(callback: () => void): void;
continueImmediate(result: Result): void;
processEvent(body: () => any, receiver: (x: Result) => void): void;
/** Start an external higher-order function. */
externalHOF(body: (complete: (result: Result) => void) => void): void;
/** Run Stopified code from an external higher-order function. */
runStopifiedCode(body: () => void, callback: (x: Result) => void): void;
}