Maybe it's not super-cool. But for people like me who doesn't feel ready to 
refactor your userscripts to the "asynchronous ways", I have created a 
little "synchronous API" which works for scripts running in both GM4 and 
the other userscript managers:

https://github.com/StigNygaard/GMCommonAPI.js

Not everything has been thoroughly tested yet, but I think it mostly works.

Current methods:


   - GMC.info
   - GMC.registerMenuCommand(caption, commandFunc, accessKey) *- This 
   creates a page context menu in GM4*
   - GMC.getResourceURL(resourceName)
   - GMC.setValue(name, value) *- See compatibility comment in source code!*
   - GMC.getValue(name, defvalue)
   - GMC.deleteValue(name)
   - GMC.setLocalStorageValue(name, value)
   - GMC.getLocalStorageValue(name, defvalue)
   - GMC.deleteLocalStorageValue(name)
   - GMC.setSessionStorageValue(name, value)
   - GMC.getSessionStorageValue(name, defvalue)
   - GMC.deleteSessionStorageValue(name)
   - GMC.log(message)
   - GMC.setClipboard(text)
   - GMC.addStyle(style)
   - GMC.openInTab(url)


-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to