-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathfiber.ts
54 lines (42 loc) · 1.45 KB
/
fiber.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
namespace $ {
/** @deprecated Use $mol_wire_fiber..plan */
export function $mol_fiber_defer< Value = void >( calculate : ()=> Value ) {
const host = {}
const fiber = new $mol_wire_task( calculate.name, calculate, host, [] )
fiber.plan()
return fiber
}
/** @deprecated Use $mol_wire_async */
export function $mol_fiber_root<
Calculate extends ( this : This , ... args : any[] )=> Result ,
Result = void ,
This = void ,
>( calculate : Calculate ) {
const wrapper = function( this: This, ... args : any[] ) {
const fiber = new $mol_wire_task( this + '.' + calculate.name, calculate, this, args )
return fiber.async()
} as any as Calculate
;( wrapper as any )[ Symbol.toStringTag ] = calculate.name
return wrapper
}
/** @deprecated Use $mol_wire_sync */
export function $mol_fiber_sync< Args extends any[] , Value = void , This = void >(
request : ( this : This , ... args : Args )=> PromiseLike< Value >
) : ( ... args : Args )=> Value {
throw new Error( 'Use $mol_wire_sync instead' )
}
/** @deprecated Use $mol_wire_fiber.sync */
export async function $mol_fiber_warp() {
$mol_wire_fiber.sync()
}
/** @deprecated Don't use that */
export class $mol_fiber_solid extends $mol_wrapper {
static func< This , Args extends any[] , Result >( task : ( this : This , ... args : Args )=> Result ) {
return task
}
}
export class $mol_fiber {
/** @deprecated Use $mol_wire_method */
static method = $mol_action
}
}