Improve loader function table handling

This commit is contained in:
dcodeIO
2018-10-20 15:40:23 +02:00
parent c4d7764851
commit 4683599a82
5 changed files with 33 additions and 20 deletions

View File

@ -66,6 +66,11 @@ interface ASUtil {
freeArray(ptr: number): void;
/** Gets a function by its pointer. */
getFunction<R = any>(ptr: number): (...args: any[]) => R;
/**
* Creates a new function in the module's table and returns its pointer. Note that only actual
* WebAssembly functions, i.e. as exported by the module, are supported.
*/
newFunction(fn: (...args: any[]) => any): number;
}
/** Instantiates an AssemblyScript module using the specified imports. */