Initial
This commit is contained in:
15
resources/app/node_modules/inflight/LICENSE
generated
vendored
Normal file
15
resources/app/node_modules/inflight/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
54
resources/app/node_modules/inflight/inflight.js
generated
vendored
Normal file
54
resources/app/node_modules/inflight/inflight.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
var wrappy = require('wrappy')
|
||||
var reqs = Object.create(null)
|
||||
var once = require('once')
|
||||
|
||||
module.exports = wrappy(inflight)
|
||||
|
||||
function inflight (key, cb) {
|
||||
if (reqs[key]) {
|
||||
reqs[key].push(cb)
|
||||
return null
|
||||
} else {
|
||||
reqs[key] = [cb]
|
||||
return makeres(key)
|
||||
}
|
||||
}
|
||||
|
||||
function makeres (key) {
|
||||
return once(function RES () {
|
||||
var cbs = reqs[key]
|
||||
var len = cbs.length
|
||||
var args = slice(arguments)
|
||||
|
||||
// XXX It's somewhat ambiguous whether a new callback added in this
|
||||
// pass should be queued for later execution if something in the
|
||||
// list of callbacks throws, or if it should just be discarded.
|
||||
// However, it's such an edge case that it hardly matters, and either
|
||||
// choice is likely as surprising as the other.
|
||||
// As it happens, we do go ahead and schedule it for later execution.
|
||||
try {
|
||||
for (var i = 0; i < len; i++) {
|
||||
cbs[i].apply(null, args)
|
||||
}
|
||||
} finally {
|
||||
if (cbs.length > len) {
|
||||
// added more in the interim.
|
||||
// de-zalgo, just in case, but don't call again.
|
||||
cbs.splice(0, len)
|
||||
process.nextTick(function () {
|
||||
RES.apply(null, args)
|
||||
})
|
||||
} else {
|
||||
delete reqs[key]
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function slice (args) {
|
||||
var length = args.length
|
||||
var array = []
|
||||
|
||||
for (var i = 0; i < length; i++) array[i] = args[i]
|
||||
return array
|
||||
}
|
||||
23
resources/app/node_modules/inflight/package.json
generated
vendored
Normal file
23
resources/app/node_modules/inflight/package.json
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "inflight",
|
||||
"version": "1.0.6",
|
||||
"description": "Add callbacks to requests in flight to avoid async duplication",
|
||||
"main": "inflight.js",
|
||||
"files": [
|
||||
"inflight.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^7.1.2"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/npm/inflight.git"
|
||||
},
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
||||
"homepage": "https://github.com/isaacs/inflight",
|
||||
"license": "ISC"
|
||||
}
|
||||
Reference in New Issue
Block a user