Hi, I wanted to use polyfill but without @require by simply copy-pasting it 
into my script but it doesn't seem to work that way... help?

this is what I copied to my userscript:

if (typeof GM == 'undefined') {
  GM = {};
}

Object.entries({
  'GM_getValue': 'getValue',
  'GM_setValue': 'setValue',
}).forEach(([oldKey, newKey]) => {
  let old = this[oldKey];
  if (old && (typeof GM[newKey] == 'undefined')) {
    GM[newKey] = function() {
      return new Promise((resolve, reject) => {
        try {
          resolve(old.apply(this, arguments));
        } catch (e) {
          reject(e);
        }
      });
    };
  }
});


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