mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
PAL module adapted to node platform (#19)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
const HTMLElement = require('./HTMLElement');
|
||||
const Event = require('./Event');
|
||||
|
||||
const _importmaps = [];
|
||||
|
||||
class HTMLScriptElement extends HTMLElement {
|
||||
constructor(width, height) {
|
||||
super('script');
|
||||
}
|
||||
|
||||
set type (type) {
|
||||
if (type === "systemjs-importmap") {
|
||||
if (_importmaps.indexOf(this) === -1) {
|
||||
_importmaps.push(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set src(url) {
|
||||
setTimeout(()=>{
|
||||
require(url);
|
||||
this.dispatchEvent(new Event('load'));
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
HTMLScriptElement._getAllScriptElementsSystemJSImportType = function () {
|
||||
return _importmaps;
|
||||
}
|
||||
|
||||
module.exports = HTMLScriptElement;
|
||||
Reference in New Issue
Block a user