mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-26 17:00:19 +01:00
fix
This commit is contained in:
parent
5a091c6214
commit
7fa61e43af
1 changed files with 2 additions and 1 deletions
|
@ -75,12 +75,13 @@ export function createAiScriptEnv(opts) {
|
||||||
*/
|
*/
|
||||||
'Mk:save': values.FN_NATIVE(([key, value]) => {
|
'Mk:save': values.FN_NATIVE(([key, value]) => {
|
||||||
utils.assertString(key);
|
utils.assertString(key);
|
||||||
|
utils.expectAny(value);
|
||||||
miLocalStorage.setItem(`aiscript:${opts.storageKey}:${key.value}`, JSON.stringify(utils.valToJs(value)));
|
miLocalStorage.setItem(`aiscript:${opts.storageKey}:${key.value}`, JSON.stringify(utils.valToJs(value)));
|
||||||
return values.NULL;
|
return values.NULL;
|
||||||
}),
|
}),
|
||||||
'Mk:load': values.FN_NATIVE(([key]) => {
|
'Mk:load': values.FN_NATIVE(([key]) => {
|
||||||
utils.assertString(key);
|
utils.assertString(key);
|
||||||
return utils.jsToVal(JSON.parse(miLocalStorage.getItem(`aiscript:${opts.storageKey}:${key.value}`)));
|
return utils.jsToVal(miLocalStorage.getItemAsJson(`aiscript:${opts.storageKey}:${key.value}`) ?? null);
|
||||||
}),
|
}),
|
||||||
'Mk:remove': values.FN_NATIVE(([key]) => {
|
'Mk:remove': values.FN_NATIVE(([key]) => {
|
||||||
utils.assertString(key);
|
utils.assertString(key);
|
||||||
|
|
Loading…
Reference in a new issue