UNPKG

1.25 kBTypeScriptView Raw
1// Type definitions for node-fibers
2// Project: https://github.com/laverdet/node-fibers
3// Definitions by: Cary Haynie <https://github.com/caryhaynie>
4// Definitions: https://github.com/borisyankov/DefinitelyTyped
5
6interface Fiber {
7 reset: () => any;
8 run: (param?: any) => any;
9 throwInto: (ex: any) => any;
10}
11
12declare module "fibers" {
13
14 function Fiber(fn: Function): Fiber;
15
16 module Fiber {
17 export var current: Fiber;
18 export function yield(value?: any): any
19 export var poolSize: number;
20 export var fibersCreated: number;
21 }
22
23 export = Fiber;
24}
25
26declare module "fibers/future" {
27
28 class Future {
29 constructor();
30 detach(): void;
31 get(): any;
32 isResolved (): boolean;
33 proxy(future: Future): void;
34 proxyErrors(futureOrList: any): Future;
35 resolver(): Function;
36 resolve(fn: Function): void;
37 resolveSuccess(fn: Function): void;
38 return(result?: any): void;
39 throw (error: any): void;
40 wait (): void;
41 static wait(future: Future);
42 static wait(future_list: Future[]);
43 static wrap(fn: Function): Future
44 }
45
46 export = Future;
47}