@peculiar/fortify-client-core
Version:
Fortify client core API for quickly connect to Fortify App
30 lines (29 loc) • 1.05 kB
JavaScript
;
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the BSD 3-Clause license found in the
* LICENSE file in the root directory of this source tree.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.polyfillInit = void 0;
if (!Uint8Array.prototype.slice) {
// eslint-disable-next-line no-extend-native
Object.defineProperty(Uint8Array.prototype, 'slice', {
value(begin, end) {
return new Uint8Array(Array.prototype.slice.call(this, begin, end));
},
});
}
const polyfillInit = async () => {
// eslint-disable-next-line @typescript-eslint/dot-notation
if (!window['protobuf']) {
await Promise.resolve().then(() => require('protobufjs/dist/protobuf.js'));
}
// eslint-disable-next-line @typescript-eslint/dot-notation
if (!window['WebcryptoSocket']) {
await Promise.resolve().then(() => require('@webcrypto-local/client/build/webcrypto-socket.mjs'));
}
};
exports.polyfillInit = polyfillInit;