We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b92f764 + e299b1e commit 8f80968Copy full SHA for 8f80968
package/src/web/LoadSkiaWeb.tsx
@@ -10,11 +10,14 @@ declare global {
10
var CanvasKit: CanvasKitType;
11
}
12
13
+let ckSharedPromise: Promise<CanvasKitType>;
14
+
15
export const LoadSkiaWeb = async (opts?: CanvasKitInitOptions) => {
16
if (global.CanvasKit !== undefined) {
17
return;
18
- const CanvasKit = await CanvasKitInit(opts);
19
+ ckSharedPromise = ckSharedPromise ?? CanvasKitInit(opts);
20
+ const CanvasKit = await ckSharedPromise;
21
// The CanvasKit API is stored on the global object and used
22
// to create the JsiSKApi in the Skia.web.ts file.
23
global.CanvasKit = CanvasKit;
0 commit comments