mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update auto-organize
This commit is contained in:
parent
12bd0f2928
commit
ffb022d13c
29 changed files with 733 additions and 387 deletions
|
@ -31,6 +31,6 @@
|
|||
"commit": "34fc5e4a0f252964ed2790138b8d7d30d04b55c1"
|
||||
},
|
||||
"_source": "git://github.com/desandro/get-style-property.git",
|
||||
"_target": "~1.0.4",
|
||||
"_target": "1.x",
|
||||
"_originalSource": "get-style-property"
|
||||
}
|
|
@ -29,14 +29,14 @@
|
|||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"ignore": [],
|
||||
"homepage": "https://github.com/polymerelements/iron-behaviors",
|
||||
"homepage": "https://github.com/PolymerElements/iron-behaviors",
|
||||
"_release": "1.0.11",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.11",
|
||||
"commit": "084fbc7f60343d717bb2208f350774f4c9899777"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/iron-behaviors.git",
|
||||
"_source": "git://github.com/PolymerElements/iron-behaviors.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "polymerelements/iron-behaviors"
|
||||
"_originalSource": "PolymerElements/iron-behaviors"
|
||||
}
|
|
@ -33,14 +33,14 @@
|
|||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"ignore": [],
|
||||
"homepage": "https://github.com/polymerelements/iron-overlay-behavior",
|
||||
"homepage": "https://github.com/PolymerElements/iron-overlay-behavior",
|
||||
"_release": "1.1.1",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.1.1",
|
||||
"commit": "1ed1603ce820456feab3f62ae86f8f3ec801d131"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/iron-overlay-behavior.git",
|
||||
"_source": "git://github.com/PolymerElements/iron-overlay-behavior.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "polymerelements/iron-overlay-behavior"
|
||||
"_originalSource": "PolymerElements/iron-overlay-behavior"
|
||||
}
|
|
@ -27,14 +27,14 @@
|
|||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"homepage": "https://github.com/polymerelements/iron-resizable-behavior",
|
||||
"homepage": "https://github.com/PolymerElements/iron-resizable-behavior",
|
||||
"_release": "1.0.2",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.2",
|
||||
"commit": "85de8ba28be2bf17c81d6436ef1119022b003674"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/iron-resizable-behavior.git",
|
||||
"_source": "git://github.com/PolymerElements/iron-resizable-behavior.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "polymerelements/iron-resizable-behavior"
|
||||
"_originalSource": "PolymerElements/iron-resizable-behavior"
|
||||
}
|
|
@ -36,7 +36,7 @@
|
|||
"tag": "v1.0.8",
|
||||
"commit": "e9a66727f3da0446f04956d4e4f1dcd51cdec2ff"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/iron-selector.git",
|
||||
"_source": "git://github.com/PolymerElements/iron-selector.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "polymerelements/iron-selector"
|
||||
"_originalSource": "PolymerElements/iron-selector"
|
||||
}
|
15
dashboard-ui/bower_components/native-promise-only/.bower.json
vendored
Normal file
15
dashboard-ui/bower_components/native-promise-only/.bower.json
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "native-promise-only",
|
||||
"homepage": "https://github.com/getify/native-promise-only",
|
||||
"version": "0.8.0-a",
|
||||
"_release": "0.8.0-a",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.8.0-a",
|
||||
"commit": "d40a2d0197feea4f9b0bf5f8bf3079465ced3758"
|
||||
},
|
||||
"_source": "git://github.com/getify/native-promise-only.git",
|
||||
"_target": "~0.8.0-a",
|
||||
"_originalSource": "native-promise-only",
|
||||
"_direct": true
|
||||
}
|
2
dashboard-ui/bower_components/native-promise-only/.gitignore
vendored
Normal file
2
dashboard-ui/bower_components/native-promise-only/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
node_modules
|
||||
npo.js
|
2
dashboard-ui/bower_components/native-promise-only/.npmignore
vendored
Normal file
2
dashboard-ui/bower_components/native-promise-only/.npmignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
node_modules
|
||||
.gitignore
|
34
dashboard-ui/bower_components/native-promise-only/build.js
vendored
Normal file
34
dashboard-ui/bower_components/native-promise-only/build.js
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
var fs = require("fs"),
|
||||
path = require("path"),
|
||||
exec = require("child_process").exec,
|
||||
ugly = require("uglify-js"),
|
||||
|
||||
result
|
||||
;
|
||||
|
||||
console.log("*** Building ***");
|
||||
console.log("Minifying to npo.js.");
|
||||
|
||||
try {
|
||||
result = ugly.minify(path.join(__dirname,"lib","npo.src.js"),{
|
||||
mangle: true,
|
||||
compress: true,
|
||||
output: {
|
||||
comments: /^!/
|
||||
}
|
||||
});
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(__dirname,"npo.js"),
|
||||
result.code + "\n",
|
||||
{ encoding: "utf8" }
|
||||
);
|
||||
|
||||
console.log("Complete.");
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
373
dashboard-ui/bower_components/native-promise-only/lib/npo.src.js
vendored
Normal file
373
dashboard-ui/bower_components/native-promise-only/lib/npo.src.js
vendored
Normal file
|
@ -0,0 +1,373 @@
|
|||
/*! Native Promise Only
|
||||
v0.8.0-a (c) Kyle Simpson
|
||||
MIT License: http://getify.mit-license.org
|
||||
*/
|
||||
|
||||
(function UMD(name,context,definition){
|
||||
// special form of UMD for polyfilling across evironments
|
||||
context[name] = context[name] || definition();
|
||||
if (typeof module != "undefined" && module.exports) { module.exports = context[name]; }
|
||||
else if (typeof define == "function" && define.amd) { define(function $AMD$(){ return context[name]; }); }
|
||||
})("Promise",typeof global != "undefined" ? global : this,function DEF(){
|
||||
/*jshint validthis:true */
|
||||
"use strict";
|
||||
|
||||
var builtInProp, cycle, scheduling_queue,
|
||||
ToString = Object.prototype.toString,
|
||||
timer = (typeof setImmediate != "undefined") ?
|
||||
function timer(fn) { return setImmediate(fn); } :
|
||||
setTimeout
|
||||
;
|
||||
|
||||
// dammit, IE8.
|
||||
try {
|
||||
Object.defineProperty({},"x",{});
|
||||
builtInProp = function builtInProp(obj,name,val,config) {
|
||||
return Object.defineProperty(obj,name,{
|
||||
value: val,
|
||||
writable: true,
|
||||
configurable: config !== false
|
||||
});
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
builtInProp = function builtInProp(obj,name,val) {
|
||||
obj[name] = val;
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
|
||||
// Note: using a queue instead of array for efficiency
|
||||
scheduling_queue = (function Queue() {
|
||||
var first, last, item;
|
||||
|
||||
function Item(fn,self) {
|
||||
this.fn = fn;
|
||||
this.self = self;
|
||||
this.next = void 0;
|
||||
}
|
||||
|
||||
return {
|
||||
add: function add(fn,self) {
|
||||
item = new Item(fn,self);
|
||||
if (last) {
|
||||
last.next = item;
|
||||
}
|
||||
else {
|
||||
first = item;
|
||||
}
|
||||
last = item;
|
||||
item = void 0;
|
||||
},
|
||||
drain: function drain() {
|
||||
var f = first;
|
||||
first = last = cycle = void 0;
|
||||
|
||||
while (f) {
|
||||
f.fn.call(f.self);
|
||||
f = f.next;
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
function schedule(fn,self) {
|
||||
scheduling_queue.add(fn,self);
|
||||
if (!cycle) {
|
||||
cycle = timer(scheduling_queue.drain);
|
||||
}
|
||||
}
|
||||
|
||||
// promise duck typing
|
||||
function isThenable(o) {
|
||||
var _then, o_type = typeof o;
|
||||
|
||||
if (o != null &&
|
||||
(
|
||||
o_type == "object" || o_type == "function"
|
||||
)
|
||||
) {
|
||||
_then = o.then;
|
||||
}
|
||||
return typeof _then == "function" ? _then : false;
|
||||
}
|
||||
|
||||
function notify() {
|
||||
for (var i=0; i<this.chain.length; i++) {
|
||||
notifyIsolated(
|
||||
this,
|
||||
(this.state === 1) ? this.chain[i].success : this.chain[i].failure,
|
||||
this.chain[i]
|
||||
);
|
||||
}
|
||||
this.chain.length = 0;
|
||||
}
|
||||
|
||||
// NOTE: This is a separate function to isolate
|
||||
// the `try..catch` so that other code can be
|
||||
// optimized better
|
||||
function notifyIsolated(self,cb,chain) {
|
||||
var ret, _then;
|
||||
try {
|
||||
if (cb === false) {
|
||||
chain.reject(self.msg);
|
||||
}
|
||||
else {
|
||||
if (cb === true) {
|
||||
ret = self.msg;
|
||||
}
|
||||
else {
|
||||
ret = cb.call(void 0,self.msg);
|
||||
}
|
||||
|
||||
if (ret === chain.promise) {
|
||||
chain.reject(TypeError("Promise-chain cycle"));
|
||||
}
|
||||
else if (_then = isThenable(ret)) {
|
||||
_then.call(ret,chain.resolve,chain.reject);
|
||||
}
|
||||
else {
|
||||
chain.resolve(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
chain.reject(err);
|
||||
}
|
||||
}
|
||||
|
||||
function resolve(msg) {
|
||||
var _then, self = this;
|
||||
|
||||
// already triggered?
|
||||
if (self.triggered) { return; }
|
||||
|
||||
self.triggered = true;
|
||||
|
||||
// unwrap
|
||||
if (self.def) {
|
||||
self = self.def;
|
||||
}
|
||||
|
||||
try {
|
||||
if (_then = isThenable(msg)) {
|
||||
schedule(function(){
|
||||
var def_wrapper = new MakeDefWrapper(self);
|
||||
try {
|
||||
_then.call(msg,
|
||||
function $resolve$(){ resolve.apply(def_wrapper,arguments); },
|
||||
function $reject$(){ reject.apply(def_wrapper,arguments); }
|
||||
);
|
||||
}
|
||||
catch (err) {
|
||||
reject.call(def_wrapper,err);
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
self.msg = msg;
|
||||
self.state = 1;
|
||||
if (self.chain.length > 0) {
|
||||
schedule(notify,self);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
reject.call(new MakeDefWrapper(self),err);
|
||||
}
|
||||
}
|
||||
|
||||
function reject(msg) {
|
||||
var self = this;
|
||||
|
||||
// already triggered?
|
||||
if (self.triggered) { return; }
|
||||
|
||||
self.triggered = true;
|
||||
|
||||
// unwrap
|
||||
if (self.def) {
|
||||
self = self.def;
|
||||
}
|
||||
|
||||
self.msg = msg;
|
||||
self.state = 2;
|
||||
if (self.chain.length > 0) {
|
||||
schedule(notify,self);
|
||||
}
|
||||
}
|
||||
|
||||
function iteratePromises(Constructor,arr,resolver,rejecter) {
|
||||
for (var idx=0; idx<arr.length; idx++) {
|
||||
(function IIFE(idx){
|
||||
Constructor.resolve(arr[idx])
|
||||
.then(
|
||||
function $resolver$(msg){
|
||||
resolver(idx,msg);
|
||||
},
|
||||
rejecter
|
||||
);
|
||||
})(idx);
|
||||
}
|
||||
}
|
||||
|
||||
function MakeDefWrapper(self) {
|
||||
this.def = self;
|
||||
this.triggered = false;
|
||||
}
|
||||
|
||||
function MakeDef(self) {
|
||||
this.promise = self;
|
||||
this.state = 0;
|
||||
this.triggered = false;
|
||||
this.chain = [];
|
||||
this.msg = void 0;
|
||||
}
|
||||
|
||||
function Promise(executor) {
|
||||
if (typeof executor != "function") {
|
||||
throw TypeError("Not a function");
|
||||
}
|
||||
|
||||
if (this.__NPO__ !== 0) {
|
||||
throw TypeError("Not a promise");
|
||||
}
|
||||
|
||||
// instance shadowing the inherited "brand"
|
||||
// to signal an already "initialized" promise
|
||||
this.__NPO__ = 1;
|
||||
|
||||
var def = new MakeDef(this);
|
||||
|
||||
this["then"] = function then(success,failure) {
|
||||
var o = {
|
||||
success: typeof success == "function" ? success : true,
|
||||
failure: typeof failure == "function" ? failure : false
|
||||
};
|
||||
// Note: `then(..)` itself can be borrowed to be used against
|
||||
// a different promise constructor for making the chained promise,
|
||||
// by substituting a different `this` binding.
|
||||
o.promise = new this.constructor(function extractChain(resolve,reject) {
|
||||
if (typeof resolve != "function" || typeof reject != "function") {
|
||||
throw TypeError("Not a function");
|
||||
}
|
||||
|
||||
o.resolve = resolve;
|
||||
o.reject = reject;
|
||||
});
|
||||
def.chain.push(o);
|
||||
|
||||
if (def.state !== 0) {
|
||||
schedule(notify,def);
|
||||
}
|
||||
|
||||
return o.promise;
|
||||
};
|
||||
this["catch"] = function $catch$(failure) {
|
||||
return this.then(void 0,failure);
|
||||
};
|
||||
|
||||
try {
|
||||
executor.call(
|
||||
void 0,
|
||||
function publicResolve(msg){
|
||||
resolve.call(def,msg);
|
||||
},
|
||||
function publicReject(msg) {
|
||||
reject.call(def,msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
catch (err) {
|
||||
reject.call(def,err);
|
||||
}
|
||||
}
|
||||
|
||||
var PromisePrototype = builtInProp({},"constructor",Promise,
|
||||
/*configurable=*/false
|
||||
);
|
||||
|
||||
// Note: Android 4 cannot use `Object.defineProperty(..)` here
|
||||
Promise.prototype = PromisePrototype;
|
||||
|
||||
// built-in "brand" to signal an "uninitialized" promise
|
||||
builtInProp(PromisePrototype,"__NPO__",0,
|
||||
/*configurable=*/false
|
||||
);
|
||||
|
||||
builtInProp(Promise,"resolve",function Promise$resolve(msg) {
|
||||
var Constructor = this;
|
||||
|
||||
// spec mandated checks
|
||||
// note: best "isPromise" check that's practical for now
|
||||
if (msg && typeof msg == "object" && msg.__NPO__ === 1) {
|
||||
return msg;
|
||||
}
|
||||
|
||||
return new Constructor(function executor(resolve,reject){
|
||||
if (typeof resolve != "function" || typeof reject != "function") {
|
||||
throw TypeError("Not a function");
|
||||
}
|
||||
|
||||
resolve(msg);
|
||||
});
|
||||
});
|
||||
|
||||
builtInProp(Promise,"reject",function Promise$reject(msg) {
|
||||
return new this(function executor(resolve,reject){
|
||||
if (typeof resolve != "function" || typeof reject != "function") {
|
||||
throw TypeError("Not a function");
|
||||
}
|
||||
|
||||
reject(msg);
|
||||
});
|
||||
});
|
||||
|
||||
builtInProp(Promise,"all",function Promise$all(arr) {
|
||||
var Constructor = this;
|
||||
|
||||
// spec mandated checks
|
||||
if (ToString.call(arr) != "[object Array]") {
|
||||
return Constructor.reject(TypeError("Not an array"));
|
||||
}
|
||||
if (arr.length === 0) {
|
||||
return Constructor.resolve([]);
|
||||
}
|
||||
|
||||
return new Constructor(function executor(resolve,reject){
|
||||
if (typeof resolve != "function" || typeof reject != "function") {
|
||||
throw TypeError("Not a function");
|
||||
}
|
||||
|
||||
var len = arr.length, msgs = Array(len), count = 0;
|
||||
|
||||
iteratePromises(Constructor,arr,function resolver(idx,msg) {
|
||||
msgs[idx] = msg;
|
||||
if (++count === len) {
|
||||
resolve(msgs);
|
||||
}
|
||||
},reject);
|
||||
});
|
||||
});
|
||||
|
||||
builtInProp(Promise,"race",function Promise$race(arr) {
|
||||
var Constructor = this;
|
||||
|
||||
// spec mandated checks
|
||||
if (ToString.call(arr) != "[object Array]") {
|
||||
return Constructor.reject(TypeError("Not an array"));
|
||||
}
|
||||
|
||||
return new Constructor(function executor(resolve,reject){
|
||||
if (typeof resolve != "function" || typeof reject != "function") {
|
||||
throw TypeError("Not a function");
|
||||
}
|
||||
|
||||
iteratePromises(Constructor,arr,function resolver(idx,msg){
|
||||
resolve(msg);
|
||||
},reject);
|
||||
});
|
||||
});
|
||||
|
||||
return Promise;
|
||||
});
|
31
dashboard-ui/bower_components/native-promise-only/package.json
vendored
Normal file
31
dashboard-ui/bower_components/native-promise-only/package.json
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "native-promise-only",
|
||||
"version": "0.8.0-a",
|
||||
"description": "Native Promise Only: A polyfill for native ES6 Promises **only**, nothing else.",
|
||||
"main": "./npo.js",
|
||||
"scripts": {
|
||||
"test": "promises-aplus-tests test_adapter.js",
|
||||
"build": "./build.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"promises-aplus-tests": "*",
|
||||
"uglify-js": "~2.4.8"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/getify/native-promise-only.git"
|
||||
},
|
||||
"keywords": [
|
||||
"ES6",
|
||||
"Promise",
|
||||
"async",
|
||||
"promises-aplus"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/getify/native-promise-only/issues",
|
||||
"email": "getify@gmail.com"
|
||||
},
|
||||
"homepage": "http://github.com/getify/native-promise-only",
|
||||
"author": "Kyle Simpson <getify@gmail.com>",
|
||||
"license": "MIT"
|
||||
}
|
21
dashboard-ui/bower_components/native-promise-only/test_adapter.js
vendored
Normal file
21
dashboard-ui/bower_components/native-promise-only/test_adapter.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Adapter for "promises-aplus-tests" test runner
|
||||
|
||||
var path = require("path");
|
||||
var Promise = require(path.join(__dirname,"lib","npo.src.js"));
|
||||
|
||||
module.exports.deferred = function __deferred__() {
|
||||
var o = {};
|
||||
o.promise = new Promise(function __Promise__(resolve,reject){
|
||||
o.resolve = resolve;
|
||||
o.reject = reject;
|
||||
});
|
||||
return o;
|
||||
};
|
||||
|
||||
module.exports.resolved = function __resolved__(val) {
|
||||
return Promise.resolve(val);
|
||||
};
|
||||
|
||||
module.exports.rejected = function __rejected__(reason) {
|
||||
return Promise.reject(reason);
|
||||
};
|
|
@ -54,7 +54,7 @@
|
|||
"tag": "v1.0.8",
|
||||
"commit": "36656916b75a4715b025a03473620002c2650ee8"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/neon-animation.git",
|
||||
"_source": "git://github.com/PolymerElements/neon-animation.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "polymerelements/neon-animation"
|
||||
"_originalSource": "PolymerElements/neon-animation"
|
||||
}
|
|
@ -45,7 +45,7 @@
|
|||
"tag": "v1.0.10",
|
||||
"commit": "4b244a542af2c6c271498dfb98b00ed284df1d6a"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/paper-behaviors.git",
|
||||
"_source": "git://github.com/polymerelements/paper-behaviors.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/paper-behaviors"
|
||||
"_originalSource": "polymerelements/paper-behaviors"
|
||||
}
|
|
@ -50,7 +50,7 @@
|
|||
"tag": "v1.1.1",
|
||||
"commit": "1bbce220b027dc030b294163f7da6f3e9052ab13"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/paper-input.git",
|
||||
"_target": "^1.0.9",
|
||||
"_originalSource": "polymerelements/paper-input"
|
||||
"_source": "git://github.com/PolymerElements/paper-input.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/paper-input"
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"name": "promise-polyfill",
|
||||
"version": "2.1.0",
|
||||
"homepage": "https://github.com/taylorhakes/promise-polyfill",
|
||||
"authors": [
|
||||
"Taylor Hakes"
|
||||
],
|
||||
"description": "Lightweight promise polyfill for the browser and node. A+ Compliant.",
|
||||
"main": "Promise.js",
|
||||
"moduleType": [
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"es6",
|
||||
"polyfill",
|
||||
"html5"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"_release": "2.1.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "2.1.0",
|
||||
"commit": "7ee8e28671e2e7ff0304ea37c3d1fb1288645362"
|
||||
},
|
||||
"_source": "git://github.com/taylorhakes/promise-polyfill.git",
|
||||
"_target": "~2.1.0",
|
||||
"_originalSource": "promise-polyfill",
|
||||
"_direct": true
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
|
||||
uglify: {
|
||||
options: {
|
||||
banner: '/*! <%= pkg.name %> <%= pkg.version %> */\n'
|
||||
},
|
||||
dist: {
|
||||
files: {
|
||||
'Promise.min.js': ['Promise.js']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
|
||||
grunt.registerTask('build', ['uglify']);
|
||||
|
||||
};
|
|
@ -1,20 +0,0 @@
|
|||
Copyright (c) 2014 Taylor Hakes
|
||||
Copyright (c) 2014 Forbes Lindesay
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
|
@ -1,190 +0,0 @@
|
|||
(function(root) {
|
||||
|
||||
// Use polyfill for setImmediate for performance gains
|
||||
var asap = (typeof setImmediate === 'function' && setImmediate) ||
|
||||
function(fn) { setTimeout(fn, 1); };
|
||||
|
||||
// Polyfill for Function.prototype.bind
|
||||
function bind(fn, thisArg) {
|
||||
return function() {
|
||||
fn.apply(thisArg, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
var isArray = Array.isArray || function(value) { return Object.prototype.toString.call(value) === "[object Array]" };
|
||||
|
||||
function Promise(fn) {
|
||||
if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new');
|
||||
if (typeof fn !== 'function') throw new TypeError('not a function');
|
||||
this._state = null;
|
||||
this._value = null;
|
||||
this._deferreds = []
|
||||
|
||||
doResolve(fn, bind(resolve, this), bind(reject, this))
|
||||
}
|
||||
|
||||
function handle(deferred) {
|
||||
var me = this;
|
||||
if (this._state === null) {
|
||||
this._deferreds.push(deferred);
|
||||
return
|
||||
}
|
||||
asap(function() {
|
||||
var cb = me._state ? deferred.onFulfilled : deferred.onRejected
|
||||
if (cb === null) {
|
||||
(me._state ? deferred.resolve : deferred.reject)(me._value);
|
||||
return;
|
||||
}
|
||||
var ret;
|
||||
try {
|
||||
ret = cb(me._value);
|
||||
}
|
||||
catch (e) {
|
||||
deferred.reject(e);
|
||||
return;
|
||||
}
|
||||
deferred.resolve(ret);
|
||||
})
|
||||
}
|
||||
|
||||
function resolve(newValue) {
|
||||
try { //Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
|
||||
if (newValue === this) throw new TypeError('A promise cannot be resolved with itself.');
|
||||
if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {
|
||||
var then = newValue.then;
|
||||
if (typeof then === 'function') {
|
||||
doResolve(bind(then, newValue), bind(resolve, this), bind(reject, this));
|
||||
return;
|
||||
}
|
||||
}
|
||||
this._state = true;
|
||||
this._value = newValue;
|
||||
finale.call(this);
|
||||
} catch (e) { reject.call(this, e); }
|
||||
}
|
||||
|
||||
function reject(newValue) {
|
||||
this._state = false;
|
||||
this._value = newValue;
|
||||
finale.call(this);
|
||||
}
|
||||
|
||||
function finale() {
|
||||
for (var i = 0, len = this._deferreds.length; i < len; i++) {
|
||||
handle.call(this, this._deferreds[i]);
|
||||
}
|
||||
this._deferreds = null;
|
||||
}
|
||||
|
||||
function Handler(onFulfilled, onRejected, resolve, reject){
|
||||
this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
|
||||
this.onRejected = typeof onRejected === 'function' ? onRejected : null;
|
||||
this.resolve = resolve;
|
||||
this.reject = reject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Take a potentially misbehaving resolver function and make sure
|
||||
* onFulfilled and onRejected are only called once.
|
||||
*
|
||||
* Makes no guarantees about asynchrony.
|
||||
*/
|
||||
function doResolve(fn, onFulfilled, onRejected) {
|
||||
var done = false;
|
||||
try {
|
||||
fn(function (value) {
|
||||
if (done) return;
|
||||
done = true;
|
||||
onFulfilled(value);
|
||||
}, function (reason) {
|
||||
if (done) return;
|
||||
done = true;
|
||||
onRejected(reason);
|
||||
})
|
||||
} catch (ex) {
|
||||
if (done) return;
|
||||
done = true;
|
||||
onRejected(ex);
|
||||
}
|
||||
}
|
||||
|
||||
Promise.prototype['catch'] = function (onRejected) {
|
||||
return this.then(null, onRejected);
|
||||
};
|
||||
|
||||
Promise.prototype.then = function(onFulfilled, onRejected) {
|
||||
var me = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
handle.call(me, new Handler(onFulfilled, onRejected, resolve, reject));
|
||||
})
|
||||
};
|
||||
|
||||
Promise.all = function () {
|
||||
var args = Array.prototype.slice.call(arguments.length === 1 && isArray(arguments[0]) ? arguments[0] : arguments);
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (args.length === 0) return resolve([]);
|
||||
var remaining = args.length;
|
||||
function res(i, val) {
|
||||
try {
|
||||
if (val && (typeof val === 'object' || typeof val === 'function')) {
|
||||
var then = val.then;
|
||||
if (typeof then === 'function') {
|
||||
then.call(val, function (val) { res(i, val) }, reject);
|
||||
return;
|
||||
}
|
||||
}
|
||||
args[i] = val;
|
||||
if (--remaining === 0) {
|
||||
resolve(args);
|
||||
}
|
||||
} catch (ex) {
|
||||
reject(ex);
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
res(i, args[i]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Promise.resolve = function (value) {
|
||||
if (value && typeof value === 'object' && value.constructor === Promise) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
resolve(value);
|
||||
});
|
||||
};
|
||||
|
||||
Promise.reject = function (value) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
reject(value);
|
||||
});
|
||||
};
|
||||
|
||||
Promise.race = function (values) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
for(var i = 0, len = values.length; i < len; i++) {
|
||||
values[i].then(resolve, reject);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the immediate function to execute callbacks
|
||||
* @param fn {function} Function to execute
|
||||
* @private
|
||||
*/
|
||||
Promise._setImmediateFn = function _setImmediateFn(fn) {
|
||||
asap = fn;
|
||||
};
|
||||
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = Promise;
|
||||
} else if (!root.Promise) {
|
||||
root.Promise = Promise;
|
||||
}
|
||||
|
||||
})(this);
|
|
@ -1,2 +0,0 @@
|
|||
/*! promise-polyfill 2.1.0 */
|
||||
!function(a){function b(a,b){return function(){a.apply(b,arguments)}}function c(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],i(a,b(e,this),b(f,this))}function d(a){var b=this;return null===this._state?void this._deferreds.push(a):void j(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function e(a){try{if(a===this)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"==typeof a||"function"==typeof a)){var c=a.then;if("function"==typeof c)return void i(b(c,a),b(e,this),b(f,this))}this._state=!0,this._value=a,g.call(this)}catch(d){f.call(this,d)}}function f(a){this._state=!1,this._value=a,g.call(this)}function g(){for(var a=0,b=this._deferreds.length;b>a;a++)d.call(this,this._deferreds[a]);this._deferreds=null}function h(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function i(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}var j="function"==typeof setImmediate&&setImmediate||function(a){setTimeout(a,1)},k=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};c.prototype["catch"]=function(a){return this.then(null,a)},c.prototype.then=function(a,b){var e=this;return new c(function(c,f){d.call(e,new h(a,b,c,f))})},c.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&k(arguments[0])?arguments[0]:arguments);return new c(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(i){c(i)}}if(0===a.length)return b([]);for(var e=a.length,f=0;f<a.length;f++)d(f,a[f])})},c.resolve=function(a){return a&&"object"==typeof a&&a.constructor===c?a:new c(function(b){b(a)})},c.reject=function(a){return new c(function(b,c){c(a)})},c.race=function(a){return new c(function(b,c){for(var d=0,e=a.length;e>d;d++)a[d].then(b,c)})},c._setImmediateFn=function(a){j=a},"undefined"!=typeof module&&module.exports?module.exports=c:a.Promise||(a.Promise=c)}(this);
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"name": "promise-polyfill",
|
||||
"version": "2.1.0",
|
||||
"homepage": "https://github.com/taylorhakes/promise-polyfill",
|
||||
"authors": [
|
||||
"Taylor Hakes"
|
||||
],
|
||||
"description": "Lightweight promise polyfill for the browser and node. A+ Compliant.",
|
||||
"main": "Promise.js",
|
||||
"moduleType": [
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"es6",
|
||||
"polyfill",
|
||||
"html5"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"spec_dir": "tests",
|
||||
"spec_files": [
|
||||
"**/*.spec.js"
|
||||
],
|
||||
"helpers": []
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"name": "promise-polyfill",
|
||||
"version": "2.1.0",
|
||||
"description": "Lightweight promise polyfill. A+ compliant",
|
||||
"main": "Promise.js",
|
||||
"scripts": {
|
||||
"test": "./node_modules/.bin/promises-aplus-tests tests/adapter.js && JASMINE_CONFIG_PATH=jasmine.json ./node_modules/jasmine/bin/jasmine.js;"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://taylorhakes@github.com/taylorhakes/promise-polyfill.git"
|
||||
},
|
||||
"author": "Taylor Hakes",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/taylorhakes/promise-polyfill/issues"
|
||||
},
|
||||
"homepage": "https://github.com/taylorhakes/promise-polyfill",
|
||||
"devDependencies": {
|
||||
"grunt": "^0.4.4",
|
||||
"grunt-contrib-uglify": "^0.4.0",
|
||||
"jasmine": "^2.3.1",
|
||||
"promises-aplus-tests": "*"
|
||||
},
|
||||
"keywords": [
|
||||
"promise",
|
||||
"promise-polyfill",
|
||||
"ES6",
|
||||
"promises-aplus"
|
||||
],
|
||||
"dependencies": {}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue