-
Notifications
You must be signed in to change notification settings - Fork 49
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
Suggestion - add a property initialized
(Promise object)
#126
Comments
gmc
objectinitialized
(Promise object)
+1 for this example implementation ("This shall be added to documentation for reference.") - I finally got my userscript back functioning thanks to this clear and simple example. Of course, additional things I had to do were also to convert practically all functions to async/await and add this await Please, do add this to the list of examples. |
I am recently upgrading a UserScript to the latest version and found that the get value issue before init.
Probably you can make a new property in the
gmc
object, so that it can be much easier to do coding. just like GM.getValue vs GM_getValue.All I wrote is referring to the following wiki page
https://github.com/sizzlemctwizzle/GM_config/wiki/Asynchronous-read-and-write-migration
I found it mentions multiple ways but none of them is simple or easy to use, when the coder don't want to change so much.
Implementation
This shall be added to documentation for reference.
OR you can directly add it to the code internally.
initializedResolve
is stored in the nested scope in internal coding.Benefit
To upgrade from old version to latest version, just need to add one line.
Before:
After:
Minor Remarks
await gmc.initialized.then();
syntax is to fulfill some dumb script checkers don't believeawait gmc.initialized;
is correct.The text was updated successfully, but these errors were encountered: