@shopify/react-native-skia
Version:
High-performance React Native Graphics using Skia
28 lines (25 loc) • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.LoadSkiaWeb = exports.LoadSkia = void 0;
var _canvaskit = _interopRequireDefault(require("canvaskit-wasm/bin/full/canvaskit"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
let ckSharedPromise;
const LoadSkiaWeb = async opts => {
var _ckSharedPromise;
if (global.CanvasKit !== undefined) {
return;
}
ckSharedPromise = (_ckSharedPromise = ckSharedPromise) !== null && _ckSharedPromise !== void 0 ? _ckSharedPromise : (0, _canvaskit.default)(opts);
const CanvasKit = await ckSharedPromise;
// The CanvasKit API is stored on the global object and used
// to create the JsiSKApi in the Skia.web.ts file.
global.CanvasKit = CanvasKit;
};
// We keep this function for backward compatibility
exports.LoadSkiaWeb = LoadSkiaWeb;
const LoadSkia = exports.LoadSkia = LoadSkiaWeb;
//# sourceMappingURL=LoadSkiaWeb.js.map