diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-07-12 00:38:55 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-12 00:38:55 +0900 |
| commit | 9b73e897df134ba57d4ac4d0e6e6924f8ddbc23d (patch) | |
| tree | 2885511bc46ab67c7ef7b7b40f7598e788edcd18 /src/client/scripts/create-aiscript-env.ts | |
| parent | feat(client): 無限にダイアログを出すように (diff) | |
| download | sharkey-9b73e897df134ba57d4ac4d0e6e6924f8ddbc23d.tar.gz sharkey-9b73e897df134ba57d4ac4d0e6e6924f8ddbc23d.tar.bz2 sharkey-9b73e897df134ba57d4ac4d0e6e6924f8ddbc23d.zip | |
Plugin system (#6479)
* wip
* wip
* wip
* wip
* Update store.ts
Diffstat (limited to 'src/client/scripts/create-aiscript-env.ts')
| -rw-r--r-- | src/client/scripts/create-aiscript-env.ts | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/src/client/scripts/create-aiscript-env.ts b/src/client/scripts/create-aiscript-env.ts deleted file mode 100644 index dfa38be385..0000000000 --- a/src/client/scripts/create-aiscript-env.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { utils, values } from '@syuilo/aiscript'; - -export function createAiScriptEnv(vm, opts) { - let apiRequests = 0; - return { - USER_ID: vm.$store.getters.isSignedIn ? values.STR(vm.$store.state.i.id) : values.NULL, - USER_NAME: vm.$store.getters.isSignedIn ? values.STR(vm.$store.state.i.name) : values.NULL, - USER_USERNAME: vm.$store.getters.isSignedIn ? values.STR(vm.$store.state.i.username) : values.NULL, - 'Mk:dialog': values.FN_NATIVE(async ([title, text, type]) => { - await vm.$root.dialog({ - type: type ? type.value : 'info', - title: title.value, - text: text.value, - }); - }), - 'Mk:confirm': values.FN_NATIVE(async ([title, text]) => { - const confirm = await vm.$root.dialog({ - type: 'warning', - showCancelButton: true, - title: title.value, - text: text.value, - }); - return confirm.canceled ? values.FALSE : values.TRUE; - }), - 'Mk:api': values.FN_NATIVE(async ([ep, param, token]) => { - if (token) utils.assertString(token); - apiRequests++; - if (apiRequests > 16) return values.NULL; - const res = await vm.$root.api(ep.value, utils.valToJs(param), token ? token.value : null); - return utils.jsToVal(res); - }), - 'Mk:save': values.FN_NATIVE(([key, value]) => { - utils.assertString(key); - localStorage.setItem('aiscript:' + opts.storageKey + ':' + key.value, JSON.stringify(utils.valToJs(value))); - return values.NULL; - }), - 'Mk:load': values.FN_NATIVE(([key]) => { - utils.assertString(key); - return utils.jsToVal(JSON.parse(localStorage.getItem('aiscript:' + opts.storageKey + ':' + key.value))); - }), - }; -} |