Merge pull request #946 from universe-st/PR-Branch

修复扩展添加模式时从菜单无法正常启动的问题
This commit is contained in:
Spmario233 2024-02-14 18:52:07 +08:00 committed by GitHub
commit e0616e7730
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -39,6 +39,13 @@ function generateImportFunction(type, pathParser) {
await game.import(type, await createEmptyExtension(name));
return;
}
if(type == 'mode' && lib.mode[name] && lib.mode[name].fromextension){
let loadModeMethod = lib.init['setMode_'+name];
if(typeof loadModeMethod === 'function'){
await Promise.resolve(loadModeMethod());
return;
}
}
let path = pathParser(name);
// 通过浏览器自带的script标签导入可直接获取报错信息且不会影响JS运行
// 此时代码内容也将缓存在浏览器中故再次import后将不会重新执行代码内容测试下来如此