Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocalStorageのremoveItemを呼ぶ拡張APIMk:removeがほしい #15141

Open
1 task
idat50me opened this issue Dec 16, 2024 · 0 comments
Open
1 task

LocalStorageのremoveItemを呼ぶ拡張APIMk:removeがほしい #15141

idat50me opened this issue Dec 16, 2024 · 0 comments
Labels
👩‍💻AiScript Issues related to "AiScript" and its API. "Play" or "Plugin" related issues are not included. ✨Feature This adds/improves/enhances a feature

Comments

@idat50me
Copy link

Summary

現状miLocalStorage.removeItem()に対応する拡張APIはないが、Mk:save()で保存した値を削除する用途としてMk:remove()が欲しい。

'Mk:save': values.FN_NATIVE(([key, value]) => {
utils.assertString(key);
miLocalStorage.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(miLocalStorage.getItem(`aiscript:${opts.storageKey}:${key.value}`)));
}),

Purpose

Mk:save("key", null)などとすることで値のデータ自体は削除できるが、削除していることをより明示的にする。

Do you want to implement this feature yourself?

  • Yes, I will implement this by myself and send a pull request
@idat50me idat50me added the ✨Feature This adds/improves/enhances a feature label Dec 16, 2024
@samunohito samunohito added the 👩‍💻AiScript Issues related to "AiScript" and its API. "Play" or "Plugin" related issues are not included. label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👩‍💻AiScript Issues related to "AiScript" and its API. "Play" or "Plugin" related issues are not included. ✨Feature This adds/improves/enhances a feature
Projects
Development

No branches or pull requests

2 participants