I was able to export a function that accept and call a callback when the 
promise resolves:

unsafeWindow.GM_getValue = exportFunction(function GM_getValue(name, 
defaultValue, callback) {
  GM.getValue(name, defaultValue).then(value => {
    if (callback) callback(value);
  });
}, unsafeWindow);

In the content window's scope, you can call it like:

GM_getValue('name', 'default value', value => console.log(value));

-- 
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