Skip to content

Commit

Permalink
Update mod.js
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxodin committed Sep 8, 2023
1 parent fdbbb03 commit d3f0bd6
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ var urls = {
Temporal:[window],
temporal:[window],
},
/**/
'unpkg.com/@ungap/[email protected]/es.js':{
'customElements':[window],
},
'cdn.jsdelivr.net/gh/nuxodin/[email protected]/index.min.js':{
'structuredClone':[window],
},
// 'cdn.jsdelivr.net/gh/nuxodin/[email protected]/index.min.js':{ // makes problems in safari
// 'structuredClone':[window],
// },
'cdn.jsdelivr.net/npm/[email protected]/dist/index.umd.js':{
'URLPattern':[window],
},
Expand Down Expand Up @@ -359,22 +358,17 @@ function addGetters(url, props) {
configurable: true,
get: function() {
// try { throw new Error(); } catch (e) { console.log(e.stack) } // track where it has been added
//delete obj[prop];
deleteGetters(); // we have to delete all assigned getters for a url, otherwise the script is parsed anew with every polyfill!
console.log('💊 lazyfill: "'+prop+'" polyfilled (sync!), you need the polyfill '+url);

// umd
window.exports = {};
window.module = true; // todo: needed by umd but i dont know why?

loadScriptSync('https://'+url);

//if (!this[prop]) this[prop] = exports[prop]; // todo: loop exports?
//return this[prop];

// if (!this[prop]) this[prop] = exports[prop]; // todo: loop exports?
// new: polyfill the prototype, not the instance, ok?
if (!obj[prop]) obj[prop] = exports[prop]; // todo: loop exports?
return obj[prop];
return this[prop];
},
set: function(v) {
//deleteGetters();
Expand Down

0 comments on commit d3f0bd6

Please sign in to comment.