forked from firka/flutter
[dart2wasm] Move web wasm embedder to new dart2wasm embedder API (flutter/engine#55037)
This removes usages of the deprecated top-level `instantiate` and `invoke` methods and replaces it by method calls to the embedder objects. See [0] for the change that introduce this embedder API. [0] https://dart-review.googlesource.com/c/sdk/+/383242/6
This commit is contained in:
committed by
GitHub
parent
0cbf92d4f2
commit
f469f967d8
@@ -155,11 +155,11 @@ export class FlutterEntrypointLoader {
|
||||
}
|
||||
const jsSupportRuntime = await import(jsSupportRuntimeUri);
|
||||
|
||||
const dartModulePromise = jsSupportRuntime.compileStreaming(fetch(moduleUri));
|
||||
const compiledDartAppPromise = jsSupportRuntime.compileStreaming(fetch(moduleUri));
|
||||
|
||||
let imports;
|
||||
let importsPromise;
|
||||
if (build.renderer === "skwasm") {
|
||||
imports = (async () => {
|
||||
importsPromise = (async () => {
|
||||
const skwasmInstance = await deps.skwasm;
|
||||
window._flutter_skwasmInstance = skwasmInstance;
|
||||
return {
|
||||
@@ -171,10 +171,11 @@ export class FlutterEntrypointLoader {
|
||||
};
|
||||
})();
|
||||
} else {
|
||||
imports = {};
|
||||
importsPromise = Promise.resolve({});
|
||||
}
|
||||
const moduleInstance = await jsSupportRuntime.instantiate(dartModulePromise, imports);
|
||||
await jsSupportRuntime.invoke(moduleInstance);
|
||||
const compiledDartApp = await compiledDartAppPromise;
|
||||
const dartApp = await compiledDartApp.instantiate(await importsPromise);
|
||||
await dartApp.invokeMain();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user