• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/// <reference path="../bindings/embind.d.ts" />
2declare const Module: embind.EmbindModule;
3// eslint-disable-next-line @typescript-eslint/no-unused-vars
4const CanvasKit = Module; // lets other files use this alias to declare new public APIs.
5// eslint-disable-next-line @typescript-eslint/no-unused-vars
6namespace load {
7    type CallbackFn = () => void;
8    const toLoad: CallbackFn[] = [];
9    export const afterLoad = (callback: CallbackFn): void => {
10      toLoad.push(callback);
11    };
12
13    Module.onRuntimeInitialized = () => {
14      console.log('runtime initialized');
15      toLoad.forEach(((callback) => callback()));
16    };
17}
18