Skip to content

Instantly share code, notes, and snippets.

View liaobinbin's full-sized avatar
💫
Focusing

Boiao Ch liaobinbin

💫
Focusing
View GitHub Profile
@jspenguin2017
jspenguin2017 / onbeforescriptexecute.html
Last active August 12, 2018 15:59
A (somewhat working) polyfill for beforescriptexecute event
MOVED TO: https://github.com/jspenguin2017/Snippets/tree/master
@james2doyle
james2doyle / get-script-promise.js
Created November 17, 2016 18:37
Async load a script in the page and run it. Uses promises
// this function will work cross-browser for loading scripts asynchronously
function loadScript(src) {
return new Promise(function(resolve, reject) {
const s = document.createElement('script');
let r = false;
s.type = 'text/javascript';
s.src = src;
s.async = true;
s.onerror = function(err) {
reject(err, s);