Skip to content

Instantly share code, notes, and snippets.

@thelastinuit
Created July 30, 2020 14:21
Show Gist options
  • Save thelastinuit/96382d2c2f729021ff6a1018c40acdcb to your computer and use it in GitHub Desktop.
Save thelastinuit/96382d2c2f729021ff6a1018c40acdcb to your computer and use it in GitHub Desktop.
/* htts://sample.io/app.js
*
*/
(function() {
var BadgeInjector = (function (name) {
var root = typeof window !== 'undefined' ? window : global;
var had = Object.prototype.hasOwnProperty.call(root, name);
var prev = root[name];
var me = root[name] = {};
if (typeof module !== 'undefined' && module.exports)
module.exports = me;
me.noConflict = function () {
if (root[name] === me) {
root[name] = had ? prev : undefined;
if (!had) {
try { delete root[name]; }
catch (ex) {}
}
}
return me;
};
return me;
}('BadgeInjector'));
BadgeInjector.init = function() {};
}());
/* htts://another-sample.io/loader.js
*
*/
function loadScript(url, callback) {
var script = document.createElement("script");
script.type = "text/javascript";
if (script.readyState) { // IE
script.onreadystatechange = function() {
if (script.readyState == "loaded" || script.readyState == "complete") {
script.onreadystatechange = null;
callback();
}
};
} else { // Others
script.onload = function() {
callback();
};
}
script.src = url;
document.body.appendChild(script);
}
loadScript("https://unpkg.com/vue", function() {
console.log("Vue Loaded...");
console.log("Loading Vuetify...");
loadScript("https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.js", function() {
console.log("Vuefity Loaded...");
console.log("Loading Badge App...");
loadScript("https://sample.io/app.js?ignore_cache=true", function() {
console.log("Baged App loaded.");
BadgeInjector.init();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment