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

Feature request: GM Value persistence APIs #167

Closed
SilverEzhik opened this issue Nov 20, 2021 · 6 comments
Closed

Feature request: GM Value persistence APIs #167

SilverEzhik opened this issue Nov 20, 2021 · 6 comments
Projects

Comments

@SilverEzhik
Copy link

Greasemonkey and other user script managers include asynchronous APIs which can be used to save and load string/integer/boolean values:

This allows creating user scripts which can persist values across websites or allow for configuration by the user without modifying the script source. For example, I could add a checkbox to temporarily enable debug output in my script and have that change persist across page reloads and domain changes.

I think this is the only feature I'm missing, absolutely loving using this on iOS otherwise :). Being able to point the userscripts folder to cloud storage and having everything automatically update as I edit scripts from my PC is a godsend.

@quoid
Copy link
Owner

quoid commented Nov 20, 2021

Thanks for the request @SilverEzhik - adding additional GM api methods are next on the list (after getting these current versions released).

@quoid
Copy link
Owner

quoid commented Nov 22, 2021

@SilverEzhik newest iOS and macOS builds will have these methods exposed to the user

@SilverEzhik
Copy link
Author

Awesome, I can confirm that it works with my scripts, though it looks like @grant only checks for GM_ and not GM.

Also, taking a quick look at the source, it looks like GM_ and GM. variants are identical, but there's actually a difference between the two since GM_ variants are synchronous while GM. variants are supposed to be asynchronous. This is fine for me since I've already been using asynchronous variants, but if backwards compatibility is a concern, it might be better to remove GM_ variants and leave a note in the documentation pointing to async variants.

Here's a relevant discussion for a different user script manager with a similar issue: erosman/support#98

@SilverEzhik
Copy link
Author

SilverEzhik commented Nov 22, 2021

By the way, Violentmonkey has a good reference for all the GM APIs: https://violentmonkey.github.io/api/gm

@quoid
Copy link
Owner

quoid commented Nov 22, 2021

@SilverEzhik

Also, taking a quick look at the source, it looks like GM_ and GM. variants are identical, but there's actually a difference between the two since GM_ variants are synchronous while GM. variants are supposed to be asynchronous. This is fine for me since I've already been using asynchronous variants, but if backwards compatibility is a concern, it might be better to remove GM_ variants and leave a note in the documentation pointing to async variants.

Thank you very much for this info. I had no idea of these differences. I think considering this, I will remove the GM_ variants and update @grant to check for GM.. If backwards compatability is desired, the old GM_ variants can always be added in at a later date.

Thanks again

@quoid
Copy link
Owner

quoid commented Jan 6, 2022

merged b8b8a7f

@quoid quoid closed this as completed Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Tasks
  
Release
Development

No branches or pull requests

2 participants