parent
79e4c4a104
commit
2ca8fa6e66
5 changed files with 16 additions and 7 deletions
12
.eslintrc.js
12
.eslintrc.js
|
|
@ -4,6 +4,9 @@ module.exports = {
|
||||||
"commonjs": true,
|
"commonjs": true,
|
||||||
"node": true
|
"node": true
|
||||||
},
|
},
|
||||||
|
"globals": {
|
||||||
|
"Promise": true
|
||||||
|
},
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
"rules": {
|
"rules": {
|
||||||
"accessor-pairs": "error",
|
"accessor-pairs": "error",
|
||||||
|
|
@ -67,7 +70,7 @@ module.exports = {
|
||||||
"keyword-spacing": "off",
|
"keyword-spacing": "off",
|
||||||
"linebreak-style": [
|
"linebreak-style": [
|
||||||
"error",
|
"error",
|
||||||
"windows"
|
"unix"
|
||||||
],
|
],
|
||||||
"lines-around-comment": "error",
|
"lines-around-comment": "error",
|
||||||
"max-depth": "off",
|
"max-depth": "off",
|
||||||
|
|
@ -134,6 +137,7 @@ module.exports = {
|
||||||
"no-process-env": "error",
|
"no-process-env": "error",
|
||||||
"no-process-exit": "error",
|
"no-process-exit": "error",
|
||||||
"no-proto": "error",
|
"no-proto": "error",
|
||||||
|
"no-redeclare": "off",
|
||||||
"no-restricted-globals": "error",
|
"no-restricted-globals": "error",
|
||||||
"no-restricted-imports": "error",
|
"no-restricted-imports": "error",
|
||||||
"no-restricted-modules": "error",
|
"no-restricted-modules": "error",
|
||||||
|
|
@ -161,6 +165,12 @@ module.exports = {
|
||||||
"no-unneeded-ternary": "error",
|
"no-unneeded-ternary": "error",
|
||||||
"no-unsafe-finally": "error",
|
"no-unsafe-finally": "error",
|
||||||
"no-unused-expressions": "off",
|
"no-unused-expressions": "off",
|
||||||
|
"no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"varsIgnorePattern": "module"
|
||||||
|
}
|
||||||
|
],
|
||||||
"no-use-before-define": "off",
|
"no-use-before-define": "off",
|
||||||
"no-useless-call": "error",
|
"no-useless-call": "error",
|
||||||
"no-useless-computed-key": "error",
|
"no-useless-computed-key": "error",
|
||||||
|
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@ coverage
|
||||||
node_modules
|
node_modules
|
||||||
jsconfig.json
|
jsconfig.json
|
||||||
.vscode
|
.vscode
|
||||||
|
npm-debug.log
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,11 @@
|
||||||
|
|
||||||
module.exports = function(callback) {
|
module.exports = function(callback) {
|
||||||
//60fps translates to 16.6ms, round it down since setTimeout requires int
|
//60fps translates to 16.6ms, round it down since setTimeout requires int
|
||||||
var time = 16
|
var time = 16
|
||||||
var last = 0, pending = null
|
var last = 0, pending = null
|
||||||
var timeout = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout
|
var timeout = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout
|
||||||
return function(synchronous) {
|
return function(synchronous) {
|
||||||
var now = new Date().getTime()
|
var now = new Date().getTime()
|
||||||
var diff = now - last
|
|
||||||
if (synchronous === true || last === 0 || now - last >= time) {
|
if (synchronous === true || last === 0 || now - last >= time) {
|
||||||
last = now
|
last = now
|
||||||
callback()
|
callback()
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ require.$$current = function() {
|
||||||
var pathnameEnd = searchIndex > -1 ? searchIndex : hashIndex > -1 ? hashIndex : href.length
|
var pathnameEnd = searchIndex > -1 ? searchIndex : hashIndex > -1 ? hashIndex : href.length
|
||||||
try {throw new Error} catch (e) {var error = e}
|
try {throw new Error} catch (e) {var error = e}
|
||||||
var src = error.stack.match(/^(?:(?!^Error|\/module\/module\.js).)*$/m).toString().match(/((?:file|https|http):\/\/.+)(?::\d+){2}/)[1] || href.slice(0, pathnameEnd)
|
var src = error.stack.match(/^(?:(?!^Error|\/module\/module\.js).)*$/m).toString().match(/((?:file|https|http):\/\/.+)(?::\d+){2}/)[1] || href.slice(0, pathnameEnd)
|
||||||
var base = href.slice(0, href.lastIndexOf("/", pathnameEnd) + 1)
|
|
||||||
return src.replace(/\.js$/, "")
|
return src.replace(/\.js$/, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -26,4 +25,4 @@ function require(name) {
|
||||||
while (dotdot.test(absolute)) absolute = absolute.replace(dotdot, "")
|
while (dotdot.test(absolute)) absolute = absolute.replace(dotdot, "")
|
||||||
if (absolute in require.$$modules) return require.$$modules[absolute]
|
if (absolute in require.$$modules) return require.$$modules[absolute]
|
||||||
else throw new Error("Module does not exist: " + absolute)
|
else throw new Error("Module does not exist: " + absolute)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ module.exports = function($window, Promise) {
|
||||||
resolve(data)
|
resolve(data)
|
||||||
$window[callbackKey] = undefined
|
$window[callbackKey] = undefined
|
||||||
}
|
}
|
||||||
script.onerror = function(e) {
|
script.onerror = function() {
|
||||||
script.parentNode.removeChild(script)
|
script.parentNode.removeChild(script)
|
||||||
reject(new Error("JSONP request failed"))
|
reject(new Error("JSONP request failed"))
|
||||||
$window[callbackKey] = undefined
|
$window[callbackKey] = undefined
|
||||||
|
|
@ -111,4 +111,4 @@ module.exports = function($window, Promise) {
|
||||||
function extract(xhr) {return xhr.responseText}
|
function extract(xhr) {return xhr.responseText}
|
||||||
|
|
||||||
return {ajax: ajax, jsonp: jsonp}
|
return {ajax: ajax, jsonp: jsonp}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue