This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var proxyContext = function(ctx) { | |
return new Proxy(ctx, { | |
get(obj, prop) { | |
if (prop in obj) { | |
return obj[prop]; | |
} | |
const newCtx = proxyContext(ctx.clone()); | |
if (prop in rules) { | |
let re = newCtx.addRule(rules[prop]); | |
return re; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Promise(excutor) { | |
let self = this; | |
self.status = 'pending'; | |
self.value = null; | |
self.reason = null; | |
self.onFulfilledCallbacks = []; | |
self.onRejectedCallbacks = []; | |
function resolve(value) { | |
if(self.status === 'pending') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(doc, win) { | |
var docEl = doc.documentElement, | |
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', | |
recalc = function() { | |
var clientWidth = docEl.clientWidth; | |
if (!clientWidth) return; | |
docEl.style.fontSize = 20 * (clientWidth / 320) + 'px'; | |
}; | |
if (!doc.addEventListener) return; | |
win.addEventListener(resizeEvt, recalc, false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(root){ | |
var modMap = {}; | |
var moduleMap = {}; | |
var cfg = { | |
baseUrl: location.href.replace(/(\/)[^\/]+$/g, function(s, s1){ | |
return s1 | |
}), | |
path: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(global){ | |
function generateJsonpCallback() { | |
return `jsonpcallback_${Date.now()}_${Math.floor(Math.random() * 100000)}`; | |
} | |
function removeScript(id) { | |
document.body.removeChild(document.getElementById(id)); | |
} | |
function removeFunc(name) { |
NewerOlder