Skip to content

Commit

Permalink
现在模组支持使用数组来指定多个要注入的代码了,这些代码之间会被自动拼接为一个更长的代码块同步执行,并一起被异步注入
Browse files Browse the repository at this point in the history
  • Loading branch information
iamapig120 committed Jan 28, 2019
1 parent 466d430 commit 46ffb35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 14 additions & 5 deletions bin/main/mainLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,20 @@ const probuildExecuteCode = executeScriptInfo => {
if (!codeEntry) {
codeEntry = 'script.js'
}
let code = fs
.readFileSync(
path.join(executeScriptInfo.filesDir, executeScriptInfo.entry)
)
.toString('utf-8')
let code = ''
if (Array.isArray(codeEntry)) {
codeEntry.forEach(codeEntry => {
code +=
'\n' +
fs
.readFileSync(path.join(executeScriptInfo.filesDir, codeEntry))
.toString('utf-8')
})
} else {
code = fs
.readFileSync(path.join(executeScriptInfo.filesDir, codeEntry))
.toString('utf-8')
}
if (!executeScriptInfo.sync) {
code = `(()=>{
let __raf
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "majsoul-plus-client",
"version": "1.8.12-alpha.2",
"version": "1.9.0-alpha.1",
"productName": "Majsoul Plus",
"author": "MajsoulPlus Team",
"description": "Majsoul Plus",
Expand Down

0 comments on commit 46ffb35

Please sign in to comment.