mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
WIP
This commit is contained in:
@ -113,7 +113,7 @@ export namespace example {
|
||||
constructor(handleTag: Symbol, handle: $wcm.ResourceHandle);
|
||||
constructor(...args: any[]) {
|
||||
super(...args, om);
|
||||
rm.registerProxy(this);
|
||||
// rm.registerProxy(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -26,8 +26,22 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
|
||||
// The context for the WASM module
|
||||
const wasmContext: WasmContext.Default = new WasmContext.Default();
|
||||
|
||||
const imports: any = {
|
||||
'foo': () => 20,
|
||||
'[export]vscode:example/types' : {
|
||||
'[resource-drop]engine': (...args: any[]) => {
|
||||
console.log(args);
|
||||
},
|
||||
'[resource-new]engine': (...args: any[]) => {
|
||||
console.log(args);
|
||||
return args[0];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Instantiate the module and create the necessary imports from the service implementation
|
||||
const instance = await WebAssembly.instantiate(module, calculator._.imports.create({ foo: () => 20 }, wasmContext));
|
||||
// const imports = calculator._.imports.create({ foo: () => 20 }, wasmContext);
|
||||
const instance = await WebAssembly.instantiate(module, imports);
|
||||
// Bind the WASM memory to the context
|
||||
wasmContext.initialize(new Memory.Default(instance.exports));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user