@@ -7,24 +7,11 @@ interface ImportsObject extends Record<string, any> {
7
7
env ?: {
8
8
memory ?: WebAssembly . Memory ,
9
9
table ?: WebAssembly . Table ,
10
- abort ?: ( msg : number , file : number , line : number , column : number ) => void ,
11
- trace ?: ( msg : number , numArgs ?: number , ...args : any [ ] ) => void
12
- }
10
+ abort ?( msg : number , file : number , line : number , column : number ) : void ,
11
+ trace ?( msg : number , numArgs ?: number , ...args : number [ ] ) : void
12
+ } ;
13
13
}
14
14
15
- type TypedArray
16
- = Int8Array
17
- | Uint8Array
18
- | Uint8ClampedArray
19
- | Int16Array
20
- | Uint16Array
21
- | Int32Array
22
- | Uint32Array
23
- | Float32Array
24
- | Float64Array
25
- | BigInt64Array
26
- | BigUint64Array ;
27
-
28
15
/** Utility mixed in by the loader. */
29
16
interface ASUtil {
30
17
/** Explicit start function, if requested. */
@@ -34,32 +21,32 @@ interface ASUtil {
34
21
/** Reads (copies) the value of a string from the module's memory. */
35
22
__getString ( ptr : number ) : string ;
36
23
/** Allocates a new array in the module's memory and returns a reference (pointer) to it. */
37
- __allocArray ( id : number , values : number [ ] ) : number ;
24
+ __allocArray ( id : number , values : ArrayLike < number > ) : number ;
38
25
/** Reads (copies) the values of an array from the module's memory. */
39
26
__getArray ( ptr : number ) : number [ ] ;
40
27
/** Gets a view on the values of an array in the module's memory. */
41
- __getArrayView ( ptr : number ) : TypedArray ;
42
- /** Reads (copies) the values of Int8Array from the module's memory. */
28
+ __getArrayView ( ptr : number ) : ArrayBufferView ;
29
+ /** Reads the values of Int8Array from the module's memory. */
43
30
__getInt8Array ( ptr : number ) : Int8Array ;
44
- /** Reads (copies) the values of Uint8Array from the module's memory. */
31
+ /** Reads the values of Uint8Array from the module's memory. */
45
32
__getUint8Array ( ptr : number ) : Uint8Array ;
46
- /** Reads (copies) the values of Uint8Array from the module's memory. */
33
+ /** Reads the values of Uint8Array from the module's memory. */
47
34
__getUint8ClampedArray ( ptr : number ) : Uint8ClampedArray ;
48
- /** Reads (copies) the values of Int16Array from the module's memory. */
35
+ /** Reads the values of Int16Array from the module's memory. */
49
36
__getInt16Array ( ptr : number ) : Int16Array ;
50
- /** Reads (copies) the values of Uint16Array from the module's memory. */
37
+ /** Reads the values of Uint16Array from the module's memory. */
51
38
__getUint16Array ( ptr : number ) : Uint16Array ;
52
- /** Reads (copies) the values of Int32Array from the module's memory. */
39
+ /** Reads the values of Int32Array from the module's memory. */
53
40
__getInt32Array ( ptr : number ) : Int32Array ;
54
- /** Reads (copies) the values of Uint32Array from the module's memory. */
41
+ /** Reads the values of Uint32Array from the module's memory. */
55
42
__getUint32Array ( ptr : number ) : Uint32Array ;
56
- /** Reads (copies) the values of Int32Array from the module's memory. */
57
- __getInt64Array ( ptr : number ) : BigInt32Array ;
58
- /** Reads (copies) the values of Uint32Array from the module's memory. */
59
- __getUint64Array ( ptr : number ) : BigUint32Array ;
60
- /** Reads (copies) the values of Float32Array from the module's memory. */
43
+ /** Reads the values of Int32Array from the module's memory. */
44
+ __getInt64Array ( ptr : number ) : BigInt64Array ;
45
+ /** Reads the values of Uint32Array from the module's memory. */
46
+ __getUint64Array ( ptr : number ) : BigUint64Array ;
47
+ /** Reads the values of Float32Array from the module's memory. */
61
48
__getFloat32Array ( ptr : number ) : Float32Array ;
62
- /** Reads (copies) the values of Float64Array from the module's memory. */
49
+ /** Reads the values of Float64Array from the module's memory. */
63
50
__getFloat64Array ( ptr : number ) : Float64Array ;
64
51
/** Reads (copies) the data of an ArrayBuffer from the module's memory. */
65
52
__getArrayBuffer ( ptr : number ) : ArrayBuffer ;
@@ -79,10 +66,10 @@ interface ASUtil {
79
66
export declare function instantiate < T extends { } > ( module : WebAssembly . Module , imports ?: ImportsObject ) : ASUtil & T ;
80
67
81
68
/** Instantiates an AssemblyScript module from a buffer using the specified imports. */
82
- export declare function instantiateBuffer < T extends { } > ( buffer : Uint8Array , imports ?: ImportsObject ) : ASUtil & T ;
69
+ export declare function instantiateBuffer < T extends { } > ( buffer : BufferSource , imports ?: ImportsObject ) : ASUtil & T ;
83
70
84
71
/** Instantiates an AssemblyScript module from a response using the specified imports. */
85
- export declare function instantiateStreaming < T extends { } > ( result : Promise < Response > , imports ?: ImportsObject ) : Promise < ASUtil & T > ;
72
+ export declare function instantiateStreaming < T extends { } > ( result : Response | PromiseLike < Response > , imports ?: ImportsObject ) : Promise < ASUtil & T > ;
86
73
87
74
/** Demangles an AssemblyScript module's exports to a friendly object structure. */
88
75
export declare function demangle < T extends { } > ( exports : { } , baseModule ?: { } ) : T ;
0 commit comments