Files
Hippy/core/js/global/DynamicLoad.js
T
2021-08-03 22:40:17 +08:00

14 lines
454 B
JavaScript

/* eslint-disable no-undef */
/* eslint-disable no-underscore-dangle */
const ContextifyModule = internalBinding('ContextifyModule');
global.dynamicLoad = (path, encode, cb) => {
let requestPath = path || '';
const isSchema = ['https://', 'http://', '//'].some(schema => requestPath.indexOf(schema) === 0);
if (!isSchema) {
requestPath = global.__HIPPYCURDIR__ + path;
}
ContextifyModule.LoadUntrustedContent(requestPath, encode, cb);
};