| 1 |
/// <reference path="../bindings/embind.d.ts" /> |
| 2 |
declare const Module: embind.EmbindModule; |
| 3 |
// eslint-disable-next-line @typescript-eslint/no-unused-vars |
| 4 |
const CanvasKit = Module; // lets other files use this alias to declare new public APIs. |
| 5 |
// eslint-disable-next-line @typescript-eslint/no-unused-vars |
| 6 |
namespace 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 |
} |