-
-
Notifications
You must be signed in to change notification settings - Fork 669
fix semicolon after interface + improve import object definition #1175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
/// <reference lib="esnext.bigint" /> | ||
|
||
interface ResultObject { | ||
module: WebAssembly.Module, | ||
instance: WebAssembly.Instance | ||
}; | ||
module: WebAssembly.Module; | ||
instance: WebAssembly.Instance; | ||
} | ||
|
||
type ImportValue = Function | WebAssembly.Global | WebAssembly.Memory | WebAssembly.Table | number; | ||
|
||
/** WebAssembly imports with two levels of nesting. */ | ||
interface ImportsObject extends Record<string, any> { | ||
interface Imports extends Record<string, Record<string, ImportValue>> { | ||
env?: { | ||
memory?: WebAssembly.Memory, | ||
table?: WebAssembly.Table, | ||
seed?: Function, | ||
MaxGraey marked this conversation as resolved.
Show resolved
Hide resolved
|
||
abort?(msg: number, file: number, line: number, column: number): void, | ||
trace?(msg: number, numArgs?: number, ...args: number[]): void | ||
}; | ||
|
@@ -99,19 +102,19 @@ interface ASUtil { | |
/** Asynchronously instantiates an AssemblyScript module from anything that can be instantiated. */ | ||
export declare function instantiate<T extends {}>( | ||
source: WebAssembly.Module | BufferSource | Response | PromiseLike<WebAssembly.Module | BufferSource | Response>, | ||
imports?: ImportsObject | ||
imports?: Imports | ||
): Promise<ResultObject & { exports: ASUtil & T }>; | ||
|
||
/** Synchronously instantiates an AssemblyScript module from a WebAssembly.Module or binary buffer. */ | ||
export declare function instantiateSync<T extends {}>( | ||
source: WebAssembly.Module | BufferSource, | ||
imports?: ImportsObject | ||
imports?: Imports | ||
): ResultObject & { exports: ASUtil & T }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not directly related to this PR, but according to MDN there's also a slight variance here: If a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure about this. but if you see this is reasonable we could do thus in separate pr |
||
|
||
/** Asynchronously instantiates an AssemblyScript module from a response, i.e. as obtained by `fetch`. */ | ||
export declare function instantiateStreaming<T extends {}>( | ||
source: Response | PromiseLike<Response>, | ||
imports?: ImportsObject | ||
imports?: Imports | ||
): Promise<ResultObject & { exports: ASUtil & T }>; | ||
|
||
/** Demangles an AssemblyScript module's exports to a friendly object structure. */ | ||
|
Uh oh!
There was an error while loading. Please reload this page.