|
1 | 1 | /** |
2 | 2 | * 作者: 小明 |
3 | 3 | * 版本: 1.0.0 |
4 | | - * 更新时间:2020-12-11 |
5 | | - * github: https://github.com/2214962083/scriptable.git |
| 4 | + * 更新时间:2020-12-14 |
| 5 | + * github: https://github.com/2214962083/ios-scriptable-tsx |
6 | 6 | */ |
7 | 7 |
|
8 | | -// @编译时间 1607657751861 |
| 8 | +// @编译时间 1607924203272 |
9 | 9 | const MODULE = module |
| 10 | +let __topLevelAwait__ = () => Promise.resolve() |
| 11 | +function EndAwait(promiseFunc) { |
| 12 | + __topLevelAwait__ = promiseFunc |
| 13 | +} |
10 | 14 |
|
11 | 15 | // src/lib/constants.ts |
12 | 16 | var URLSchemeFrom |
@@ -187,7 +191,7 @@ async function showNotification(args2) { |
187 | 191 | notification.subtitle = subtitle |
188 | 192 | notification.body = body |
189 | 193 | openURL && (notification.openURL = openURL) |
190 | | - sound && notification.sound |
| 194 | + sound && (notification.sound = sound) |
191 | 195 | notification = Object.assign(notification, others) |
192 | 196 | return await notification.schedule() |
193 | 197 | } |
@@ -516,7 +520,7 @@ function runOnClick(instance, onClick) { |
516 | 520 | } |
517 | 521 | } |
518 | 522 |
|
519 | | -// src/lib/baisc.ts |
| 523 | +// src/lib/basic.ts |
520 | 524 | var {setStorage: setStorage2, getStorage: getStorage2} = useStorage('basic-storage') |
521 | 525 | var runScriptDate = Date.now() |
522 | 526 | setStorage2('runScriptDate', runScriptDate) |
@@ -678,7 +682,9 @@ ${scriptText}` |
678 | 682 | } |
679 | 683 | async runCode(syncScriptName, scriptText) { |
680 | 684 | try { |
681 | | - const runRemoteCode = new Function(`${scriptText}`) |
| 685 | + const runRemoteCode = new Function(`(async () => { |
| 686 | + ${scriptText} |
| 687 | + })()`) |
682 | 688 | runRemoteCode() |
683 | 689 | } catch (err) { |
684 | 690 | console.log('同步的代码执行失败') |
@@ -736,3 +742,5 @@ console.__rewrite__ = true; |
736 | 742 | } |
737 | 743 | } |
738 | 744 | new Basic().init() |
| 745 | + |
| 746 | +await __topLevelAwait__() |
0 commit comments