ember-source 2.16.1 → 2.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/dist/ember-runtime.js +287 -331
- data/dist/ember-template-compiler.js +2 -2
- data/dist/ember-testing.js +1 -1
- data/dist/ember-tests.js +239 -19
- data/dist/ember-tests.prod.js +240 -19
- data/dist/ember.debug.js +298 -340
- data/dist/ember.min.js +159 -171
- data/dist/ember.prod.js +311 -349
- metadata +2 -2
data/dist/ember.debug.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
7
7
|
* @license Licensed under MIT license
|
8
8
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
9
|
-
* @version 2.16.
|
9
|
+
* @version 2.16.2
|
10
10
|
*/
|
11
11
|
|
12
12
|
var enifed, requireModule, Ember;
|
@@ -5109,26 +5109,28 @@ enifed('@glimmer/runtime', ['exports', '@glimmer/util', '@glimmer/reference', '@
|
|
5109
5109
|
var partial = _partial;
|
5110
5110
|
var partialSymbols = partial.symbolTable.symbols;
|
5111
5111
|
var outerScope = vm.scope();
|
5112
|
+
var evalScope = outerScope.getEvalScope();
|
5112
5113
|
var partialScope = vm.pushRootScope(partialSymbols.length, false);
|
5113
5114
|
partialScope.bindCallerScope(outerScope.getCallerScope());
|
5114
|
-
partialScope.bindEvalScope(
|
5115
|
+
partialScope.bindEvalScope(evalScope);
|
5115
5116
|
partialScope.bindSelf(outerScope.getSelf());
|
5116
5117
|
var evalInfo = this.evalInfo,
|
5117
5118
|
outerSymbols = this.outerSymbols;
|
5118
5119
|
|
5119
|
-
var locals = (
|
5120
|
+
var locals = Object.create(outerScope.getPartialMap());
|
5120
5121
|
for (var i = 0; i < evalInfo.length; i++) {
|
5121
5122
|
var slot = evalInfo[i];
|
5122
5123
|
var name = outerSymbols[slot - 1];
|
5123
5124
|
var ref = outerScope.getSymbol(slot);
|
5124
5125
|
locals[name] = ref;
|
5125
5126
|
}
|
5126
|
-
|
5127
|
-
|
5128
|
-
|
5129
|
-
|
5130
|
-
|
5131
|
-
|
5127
|
+
if (evalScope) {
|
5128
|
+
for (var _i2 = 0; _i2 < partialSymbols.length; _i2++) {
|
5129
|
+
var _name = partialSymbols[_i2];
|
5130
|
+
var symbol = _i2 + 1;
|
5131
|
+
var value = evalScope[_name];
|
5132
|
+
if (value !== undefined) partialScope.bind(symbol, value);
|
5133
|
+
}
|
5132
5134
|
}
|
5133
5135
|
partialScope.bindPartialMap(locals);
|
5134
5136
|
vm.pushFrame();
|
@@ -48437,7 +48439,7 @@ enifed('ember/index', ['exports', 'require', 'ember-environment', 'node-module',
|
|
48437
48439
|
enifed("ember/version", ["exports"], function (exports) {
|
48438
48440
|
"use strict";
|
48439
48441
|
|
48440
|
-
exports.default = "2.16.
|
48442
|
+
exports.default = "2.16.2";
|
48441
48443
|
});
|
48442
48444
|
enifed("handlebars", ["exports"], function (exports) {
|
48443
48445
|
"use strict";
|
@@ -52752,16 +52754,6 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
52752
52754
|
|
52753
52755
|
var _rsvp;
|
52754
52756
|
|
52755
|
-
function indexOf(callbacks, callback) {
|
52756
|
-
for (var i = 0, l = callbacks.length; i < l; i++) {
|
52757
|
-
if (callbacks[i] === callback) {
|
52758
|
-
return i;
|
52759
|
-
}
|
52760
|
-
}
|
52761
|
-
|
52762
|
-
return -1;
|
52763
|
-
}
|
52764
|
-
|
52765
52757
|
function callbacksFor(object) {
|
52766
52758
|
var callbacks = object._promiseCallbacks;
|
52767
52759
|
|
@@ -52797,7 +52789,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
52797
52789
|
callbacks = allCallbacks[eventName] = [];
|
52798
52790
|
}
|
52799
52791
|
|
52800
|
-
if (indexOf(
|
52792
|
+
if (callbacks.indexOf(callback)) {
|
52801
52793
|
callbacks.push(callback);
|
52802
52794
|
}
|
52803
52795
|
},
|
@@ -52813,7 +52805,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
52813
52805
|
|
52814
52806
|
callbacks = allCallbacks[eventName];
|
52815
52807
|
|
52816
|
-
index = indexOf(
|
52808
|
+
index = callbacks.indexOf(callback);
|
52817
52809
|
|
52818
52810
|
if (index !== -1) {
|
52819
52811
|
callbacks.splice(index, 1);
|
@@ -52849,40 +52841,6 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
52849
52841
|
}
|
52850
52842
|
}
|
52851
52843
|
|
52852
|
-
function objectOrFunction(x) {
|
52853
|
-
var type = typeof x;
|
52854
|
-
return x !== null && (type === 'object' || type === 'function');
|
52855
|
-
}
|
52856
|
-
|
52857
|
-
function isFunction(x) {
|
52858
|
-
return typeof x === 'function';
|
52859
|
-
}
|
52860
|
-
|
52861
|
-
function isObject(x) {
|
52862
|
-
return x !== null && typeof x === 'object';
|
52863
|
-
}
|
52864
|
-
|
52865
|
-
function isMaybeThenable(x) {
|
52866
|
-
return x !== null && typeof x === 'object';
|
52867
|
-
}
|
52868
|
-
|
52869
|
-
var _isArray = void 0;
|
52870
|
-
if (Array.isArray) {
|
52871
|
-
_isArray = Array.isArray;
|
52872
|
-
} else {
|
52873
|
-
_isArray = function (x) {
|
52874
|
-
return Object.prototype.toString.call(x) === '[object Array]';
|
52875
|
-
};
|
52876
|
-
}
|
52877
|
-
|
52878
|
-
var isArray = _isArray;
|
52879
|
-
|
52880
|
-
// Date.now is not available in browsers < IE9
|
52881
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
|
52882
|
-
var now = Date.now || function () {
|
52883
|
-
return new Date().getTime();
|
52884
|
-
};
|
52885
|
-
|
52886
52844
|
var queue = [];
|
52887
52845
|
|
52888
52846
|
function scheduleFlush() {
|
@@ -52914,7 +52872,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
52914
52872
|
detail: promise._result,
|
52915
52873
|
childId: child && child._id,
|
52916
52874
|
label: promise._label,
|
52917
|
-
timeStamp: now(),
|
52875
|
+
timeStamp: Date.now(),
|
52918
52876
|
error: config["instrument-with-stack"] ? new Error(promise._label) : null
|
52919
52877
|
} })) {
|
52920
52878
|
scheduleFlush();
|
@@ -52970,12 +52928,21 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
52970
52928
|
return new TypeError('A promises callback cannot return that same promise.');
|
52971
52929
|
}
|
52972
52930
|
|
52931
|
+
function objectOrFunction(x) {
|
52932
|
+
var type = typeof x;
|
52933
|
+
return x !== null && (type === 'object' || type === 'function');
|
52934
|
+
}
|
52935
|
+
|
52973
52936
|
function noop() {}
|
52974
52937
|
|
52975
52938
|
var PENDING = void 0;
|
52976
52939
|
var FULFILLED = 1;
|
52977
52940
|
var REJECTED = 2;
|
52978
52941
|
|
52942
|
+
function ErrorObject() {
|
52943
|
+
this.error = null;
|
52944
|
+
}
|
52945
|
+
|
52979
52946
|
var GET_THEN_ERROR = new ErrorObject();
|
52980
52947
|
|
52981
52948
|
function getThen(promise) {
|
@@ -52987,6 +52954,25 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
52987
52954
|
}
|
52988
52955
|
}
|
52989
52956
|
|
52957
|
+
var TRY_CATCH_ERROR = new ErrorObject();
|
52958
|
+
|
52959
|
+
var tryCatchCallback = void 0;
|
52960
|
+
function tryCatcher() {
|
52961
|
+
try {
|
52962
|
+
var target = tryCatchCallback;
|
52963
|
+
tryCatchCallback = null;
|
52964
|
+
return target.apply(this, arguments);
|
52965
|
+
} catch (e) {
|
52966
|
+
TRY_CATCH_ERROR.error = e;
|
52967
|
+
return TRY_CATCH_ERROR;
|
52968
|
+
}
|
52969
|
+
}
|
52970
|
+
|
52971
|
+
function tryCatch(fn) {
|
52972
|
+
tryCatchCallback = fn;
|
52973
|
+
return tryCatcher;
|
52974
|
+
}
|
52975
|
+
|
52990
52976
|
function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
|
52991
52977
|
try {
|
52992
52978
|
then$$1.call(value, fulfillmentHandler, rejectionHandler);
|
@@ -53032,10 +53018,10 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
53032
53018
|
reject(promise, thenable._result);
|
53033
53019
|
} else {
|
53034
53020
|
subscribe(thenable, undefined, function (value) {
|
53035
|
-
if (thenable
|
53036
|
-
resolve(promise, value, undefined);
|
53037
|
-
} else {
|
53021
|
+
if (thenable === value) {
|
53038
53022
|
fulfill(promise, value);
|
53023
|
+
} else {
|
53024
|
+
resolve(promise, value);
|
53039
53025
|
}
|
53040
53026
|
}, function (reason) {
|
53041
53027
|
return reject(promise, reason);
|
@@ -53049,9 +53035,10 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
53049
53035
|
if (isOwnThenable) {
|
53050
53036
|
handleOwnThenable(promise, maybeThenable);
|
53051
53037
|
} else if (then$$1 === GET_THEN_ERROR) {
|
53052
|
-
|
53038
|
+
var error = GET_THEN_ERROR.error;
|
53053
53039
|
GET_THEN_ERROR.error = null;
|
53054
|
-
|
53040
|
+
reject(promise, error);
|
53041
|
+
} else if (typeof then$$1 === 'function') {
|
53055
53042
|
handleForeignThenable(promise, maybeThenable, then$$1);
|
53056
53043
|
} else {
|
53057
53044
|
fulfill(promise, maybeThenable);
|
@@ -53147,46 +53134,26 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
53147
53134
|
promise._subscribers.length = 0;
|
53148
53135
|
}
|
53149
53136
|
|
53150
|
-
function ErrorObject() {
|
53151
|
-
this.error = null;
|
53152
|
-
}
|
53153
|
-
|
53154
|
-
var TRY_CATCH_ERROR = new ErrorObject();
|
53155
|
-
|
53156
|
-
function tryCatch(callback, result) {
|
53157
|
-
try {
|
53158
|
-
return callback(result);
|
53159
|
-
} catch (e) {
|
53160
|
-
TRY_CATCH_ERROR.error = e;
|
53161
|
-
return TRY_CATCH_ERROR;
|
53162
|
-
}
|
53163
|
-
}
|
53164
|
-
|
53165
53137
|
function invokeCallback(state, promise, callback, result) {
|
53166
|
-
var hasCallback =
|
53167
|
-
var value = void 0
|
53168
|
-
error = void 0;
|
53138
|
+
var hasCallback = typeof callback === 'function';
|
53139
|
+
var value = void 0;
|
53169
53140
|
|
53170
53141
|
if (hasCallback) {
|
53171
|
-
value = tryCatch(callback
|
53172
|
-
|
53173
|
-
if (value === TRY_CATCH_ERROR) {
|
53174
|
-
error = value.error;
|
53175
|
-
value.error = null; // release
|
53176
|
-
} else if (value === promise) {
|
53177
|
-
reject(promise, withOwnPromise());
|
53178
|
-
return;
|
53179
|
-
}
|
53142
|
+
value = tryCatch(callback)(result);
|
53180
53143
|
} else {
|
53181
53144
|
value = result;
|
53182
53145
|
}
|
53183
53146
|
|
53184
53147
|
if (promise._state !== PENDING) {
|
53185
53148
|
// noop
|
53186
|
-
} else if (
|
53187
|
-
|
53188
|
-
} else if (
|
53149
|
+
} else if (value === promise) {
|
53150
|
+
reject(promise, withOwnPromise());
|
53151
|
+
} else if (value === TRY_CATCH_ERROR) {
|
53152
|
+
var error = value.error;
|
53153
|
+
value.error = null; // release
|
53189
53154
|
reject(promise, error);
|
53155
|
+
} else if (hasCallback) {
|
53156
|
+
resolve(promise, value);
|
53190
53157
|
} else if (state === FULFILLED) {
|
53191
53158
|
fulfill(promise, value);
|
53192
53159
|
} else if (state === REJECTED) {
|
@@ -53243,109 +53210,118 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
53243
53210
|
return child;
|
53244
53211
|
}
|
53245
53212
|
|
53246
|
-
|
53247
|
-
|
53248
|
-
|
53249
|
-
this._abortOnReject = abortOnReject;
|
53250
|
-
|
53251
|
-
this._init.apply(this, arguments);
|
53252
|
-
}
|
53213
|
+
var Enumerator = function () {
|
53214
|
+
function Enumerator(Constructor, input, abortOnReject, label) {
|
53215
|
+
(0, _emberBabel.classCallCheck)(this, Enumerator);
|
53253
53216
|
|
53254
|
-
|
53255
|
-
|
53256
|
-
|
53257
|
-
|
53258
|
-
this._result = new Array(len);
|
53217
|
+
this._instanceConstructor = Constructor;
|
53218
|
+
this.promise = new Constructor(noop, label);
|
53219
|
+
this._abortOnReject = abortOnReject;
|
53220
|
+
this.isUsingOwnPromise = Constructor === Promise;
|
53259
53221
|
|
53260
|
-
|
53261
|
-
if (this._remaining === 0) {
|
53262
|
-
fulfill(this.promise, this._result);
|
53222
|
+
this._init.apply(this, arguments);
|
53263
53223
|
}
|
53264
|
-
};
|
53265
53224
|
|
53266
|
-
|
53267
|
-
|
53268
|
-
|
53225
|
+
Enumerator.prototype._init = function _init(Constructor, input) {
|
53226
|
+
var len = input.length || 0;
|
53227
|
+
this.length = len;
|
53228
|
+
this._remaining = len;
|
53229
|
+
this._result = new Array(len);
|
53269
53230
|
|
53270
|
-
|
53271
|
-
|
53272
|
-
|
53273
|
-
|
53231
|
+
this._enumerate(input);
|
53232
|
+
};
|
53233
|
+
|
53234
|
+
Enumerator.prototype._enumerate = function _enumerate(input) {
|
53235
|
+
var length = this.length;
|
53236
|
+
var promise = this.promise;
|
53274
53237
|
|
53275
|
-
|
53276
|
-
|
53277
|
-
|
53238
|
+
for (var i = 0; promise._state === PENDING && i < length; i++) {
|
53239
|
+
this._eachEntry(input[i], i, true);
|
53240
|
+
}
|
53278
53241
|
|
53279
|
-
|
53280
|
-
|
53242
|
+
this._checkFullfillment();
|
53243
|
+
};
|
53281
53244
|
|
53282
|
-
|
53283
|
-
|
53284
|
-
this.
|
53285
|
-
} else if (typeof then$$1 !== 'function') {
|
53286
|
-
this._remaining--;
|
53287
|
-
this._result[i] = this._makeResult(FULFILLED, i, entry);
|
53288
|
-
} else if (c === Promise) {
|
53289
|
-
var promise = new c(noop);
|
53290
|
-
handleMaybeThenable(promise, entry, then$$1);
|
53291
|
-
this._willSettleAt(promise, i);
|
53292
|
-
} else {
|
53293
|
-
this._willSettleAt(new c(function (resolve$$1) {
|
53294
|
-
return resolve$$1(entry);
|
53295
|
-
}), i);
|
53245
|
+
Enumerator.prototype._checkFullfillment = function _checkFullfillment() {
|
53246
|
+
if (this._remaining === 0) {
|
53247
|
+
fulfill(this.promise, this._result);
|
53296
53248
|
}
|
53297
|
-
}
|
53298
|
-
this._willSettleAt(resolve$$1(entry), i);
|
53299
|
-
}
|
53300
|
-
};
|
53249
|
+
};
|
53301
53250
|
|
53302
|
-
|
53303
|
-
|
53304
|
-
|
53305
|
-
} else {
|
53306
|
-
this._remaining--;
|
53307
|
-
this._result[i] = this._makeResult(FULFILLED, i, entry);
|
53308
|
-
}
|
53309
|
-
};
|
53251
|
+
Enumerator.prototype._settleMaybeThenable = function _settleMaybeThenable(entry, i, firstPass) {
|
53252
|
+
var c = this._instanceConstructor;
|
53253
|
+
var resolve$$1 = c.resolve;
|
53310
53254
|
|
53311
|
-
|
53312
|
-
|
53255
|
+
if (resolve$$1 === resolve$1) {
|
53256
|
+
var then$$1 = getThen(entry);
|
53313
53257
|
|
53314
|
-
|
53315
|
-
|
53316
|
-
|
53258
|
+
if (then$$1 === then && entry._state !== PENDING) {
|
53259
|
+
entry._onError = null;
|
53260
|
+
this._settledAt(entry._state, i, entry._result, firstPass);
|
53261
|
+
} else if (typeof then$$1 !== 'function') {
|
53262
|
+
this._settledAt(FULFILLED, i, entry, firstPass);
|
53263
|
+
} else if (this.isUsingOwnPromise) {
|
53264
|
+
var promise = new c(noop);
|
53265
|
+
handleMaybeThenable(promise, entry, then$$1);
|
53266
|
+
this._willSettleAt(promise, i, firstPass);
|
53267
|
+
} else {
|
53268
|
+
this._willSettleAt(new c(function (resolve$$1) {
|
53269
|
+
return resolve$$1(entry);
|
53270
|
+
}), i, firstPass);
|
53271
|
+
}
|
53317
53272
|
} else {
|
53318
|
-
this.
|
53319
|
-
|
53320
|
-
|
53321
|
-
|
53273
|
+
this._willSettleAt(resolve$$1(entry), i, firstPass);
|
53274
|
+
}
|
53275
|
+
};
|
53276
|
+
|
53277
|
+
Enumerator.prototype._eachEntry = function _eachEntry(entry, i, firstPass) {
|
53278
|
+
if (entry !== null && typeof entry === 'object') {
|
53279
|
+
this._settleMaybeThenable(entry, i, firstPass);
|
53280
|
+
} else {
|
53281
|
+
this._setResultAt(FULFILLED, i, entry, firstPass);
|
53282
|
+
}
|
53283
|
+
};
|
53284
|
+
|
53285
|
+
Enumerator.prototype._settledAt = function _settledAt(state, i, value, firstPass) {
|
53286
|
+
var promise = this.promise;
|
53287
|
+
|
53288
|
+
if (promise._state === PENDING) {
|
53289
|
+
if (this._abortOnReject && state === REJECTED) {
|
53290
|
+
reject(promise, value);
|
53291
|
+
} else {
|
53292
|
+
this._setResultAt(state, i, value, firstPass);
|
53293
|
+
this._checkFullfillment();
|
53322
53294
|
}
|
53323
53295
|
}
|
53324
|
-
}
|
53325
|
-
};
|
53296
|
+
};
|
53326
53297
|
|
53327
|
-
|
53328
|
-
|
53329
|
-
|
53298
|
+
Enumerator.prototype._setResultAt = function _setResultAt(state, i, value, firstPass) {
|
53299
|
+
this._remaining--;
|
53300
|
+
this._result[i] = value;
|
53301
|
+
};
|
53330
53302
|
|
53331
|
-
|
53332
|
-
|
53303
|
+
Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i, firstPass) {
|
53304
|
+
var _this = this;
|
53333
53305
|
|
53334
|
-
|
53335
|
-
|
53336
|
-
|
53337
|
-
|
53338
|
-
|
53339
|
-
|
53306
|
+
subscribe(promise, undefined, function (value) {
|
53307
|
+
return _this._settledAt(FULFILLED, i, value, firstPass);
|
53308
|
+
}, function (reason) {
|
53309
|
+
return _this._settledAt(REJECTED, i, reason, firstPass);
|
53310
|
+
});
|
53311
|
+
};
|
53312
|
+
|
53313
|
+
return Enumerator;
|
53314
|
+
}();
|
53340
53315
|
|
53341
|
-
function
|
53316
|
+
function setSettledResult(state, i, value) {
|
53317
|
+
this._remaining--;
|
53342
53318
|
if (state === FULFILLED) {
|
53343
|
-
|
53319
|
+
this._result[i] = {
|
53344
53320
|
state: 'fulfilled',
|
53345
53321
|
value: value
|
53346
53322
|
};
|
53347
53323
|
} else {
|
53348
|
-
|
53324
|
+
this._result[i] = {
|
53349
53325
|
state: 'rejected',
|
53350
53326
|
reason: value
|
53351
53327
|
};
|
@@ -53400,7 +53376,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
53400
53376
|
@static
|
53401
53377
|
*/
|
53402
53378
|
function all(entries, label) {
|
53403
|
-
if (!isArray(entries)) {
|
53379
|
+
if (!Array.isArray(entries)) {
|
53404
53380
|
return this.reject(new TypeError("Promise.all must be called with an array"), label);
|
53405
53381
|
}
|
53406
53382
|
return new Enumerator(this, entries, true /* abort on reject */, label).promise;
|
@@ -53478,7 +53454,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
53478
53454
|
|
53479
53455
|
var promise = new Constructor(noop, label);
|
53480
53456
|
|
53481
|
-
if (!isArray(entries)) {
|
53457
|
+
if (!Array.isArray(entries)) {
|
53482
53458
|
reject(promise, new TypeError('Promise.race must be called with an array'));
|
53483
53459
|
return promise;
|
53484
53460
|
}
|
@@ -53537,7 +53513,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
53537
53513
|
return promise;
|
53538
53514
|
}
|
53539
53515
|
|
53540
|
-
var guidKey = 'rsvp_' + now() + '-';
|
53516
|
+
var guidKey = 'rsvp_' + Date.now() + '-';
|
53541
53517
|
var counter = 0;
|
53542
53518
|
|
53543
53519
|
function needsResolver() {
|
@@ -53652,117 +53628,56 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
53652
53628
|
Useful for tooling.
|
53653
53629
|
@constructor
|
53654
53630
|
*/
|
53655
|
-
function Promise(resolver, label) {
|
53656
|
-
this._id = counter++;
|
53657
|
-
this._label = label;
|
53658
|
-
this._state = undefined;
|
53659
|
-
this._result = undefined;
|
53660
|
-
this._subscribers = [];
|
53661
53631
|
|
53662
|
-
|
53632
|
+
var Promise = function () {
|
53633
|
+
function Promise(resolver, label) {
|
53634
|
+
(0, _emberBabel.classCallCheck)(this, Promise);
|
53663
53635
|
|
53664
|
-
|
53665
|
-
|
53666
|
-
this
|
53667
|
-
|
53668
|
-
|
53636
|
+
this._id = counter++;
|
53637
|
+
this._label = label;
|
53638
|
+
this._state = undefined;
|
53639
|
+
this._result = undefined;
|
53640
|
+
this._subscribers = [];
|
53669
53641
|
|
53670
|
-
|
53671
|
-
var _this = this;
|
53642
|
+
config.instrument && instrument('created', this);
|
53672
53643
|
|
53673
|
-
|
53674
|
-
|
53675
|
-
|
53644
|
+
if (noop !== resolver) {
|
53645
|
+
typeof resolver !== 'function' && needsResolver();
|
53646
|
+
this instanceof Promise ? initializePromise(this, resolver) : needsNew();
|
53676
53647
|
}
|
53677
|
-
});
|
53678
|
-
};
|
53679
|
-
|
53680
|
-
/**
|
53681
|
-
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
|
53682
|
-
as the catch block of a try/catch statement.
|
53683
|
-
|
53684
|
-
```js
|
53685
|
-
function findAuthor(){
|
53686
|
-
throw new Error('couldn\'t find that author');
|
53687
|
-
}
|
53688
|
-
|
53689
|
-
// synchronous
|
53690
|
-
try {
|
53691
|
-
findAuthor();
|
53692
|
-
} catch(reason) {
|
53693
|
-
// something went wrong
|
53694
53648
|
}
|
53695
|
-
|
53696
|
-
// async with promises
|
53697
|
-
findAuthor().catch(function(reason){
|
53698
|
-
// something went wrong
|
53699
|
-
});
|
53700
|
-
```
|
53701
|
-
|
53702
|
-
@method catch
|
53703
|
-
@param {Function} onRejection
|
53704
|
-
@param {String} label optional string for labeling the promise.
|
53705
|
-
Useful for tooling.
|
53706
|
-
@return {Promise}
|
53707
|
-
*/
|
53708
|
-
Promise.prototype.catch = function (onRejection, label) {
|
53709
|
-
return this.then(undefined, onRejection, label);
|
53710
|
-
};
|
53711
53649
|
|
53712
|
-
|
53713
|
-
|
53714
|
-
try/catch/finally behaves
|
53715
|
-
|
53716
|
-
Synchronous example:
|
53717
|
-
|
53718
|
-
```js
|
53719
|
-
findAuthor() {
|
53720
|
-
if (Math.random() > 0.5) {
|
53721
|
-
throw new Error();
|
53722
|
-
}
|
53723
|
-
return new Author();
|
53724
|
-
}
|
53725
|
-
|
53726
|
-
try {
|
53727
|
-
return findAuthor(); // succeed or fail
|
53728
|
-
} catch(error) {
|
53729
|
-
return findOtherAuthor();
|
53730
|
-
} finally {
|
53731
|
-
// always runs
|
53732
|
-
// doesn't affect the return value
|
53733
|
-
}
|
53734
|
-
```
|
53735
|
-
|
53736
|
-
Asynchronous example:
|
53737
|
-
|
53738
|
-
```js
|
53739
|
-
findAuthor().catch(function(reason){
|
53740
|
-
return findOtherAuthor();
|
53741
|
-
}).finally(function(){
|
53742
|
-
// author was either found, or not
|
53743
|
-
});
|
53744
|
-
```
|
53745
|
-
|
53746
|
-
@method finally
|
53747
|
-
@param {Function} callback
|
53748
|
-
@param {String} label optional string for labeling the promise.
|
53749
|
-
Useful for tooling.
|
53750
|
-
@return {Promise}
|
53751
|
-
*/
|
53752
|
-
Promise.prototype.finally = function (callback, label) {
|
53753
|
-
var promise = this;
|
53754
|
-
var constructor = promise.constructor;
|
53650
|
+
Promise.prototype._onError = function _onError(reason) {
|
53651
|
+
var _this2 = this;
|
53755
53652
|
|
53756
|
-
|
53757
|
-
|
53758
|
-
|
53759
|
-
|
53760
|
-
}, function (reason) {
|
53761
|
-
return constructor.resolve(callback()).then(function () {
|
53762
|
-
throw reason;
|
53653
|
+
config.after(function () {
|
53654
|
+
if (_this2._onError) {
|
53655
|
+
config.trigger('error', reason, _this2._label);
|
53656
|
+
}
|
53763
53657
|
});
|
53764
|
-
}
|
53765
|
-
|
53658
|
+
};
|
53659
|
+
|
53660
|
+
Promise.prototype.catch = function _catch(onRejection, label) {
|
53661
|
+
return this.then(undefined, onRejection, label);
|
53662
|
+
};
|
53663
|
+
|
53664
|
+
Promise.prototype.finally = function _finally(callback, label) {
|
53665
|
+
var promise = this;
|
53666
|
+
var constructor = promise.constructor;
|
53667
|
+
|
53668
|
+
return promise.then(function (value) {
|
53669
|
+
return constructor.resolve(callback()).then(function () {
|
53670
|
+
return value;
|
53671
|
+
});
|
53672
|
+
}, function (reason) {
|
53673
|
+
return constructor.resolve(callback()).then(function () {
|
53674
|
+
throw reason;
|
53675
|
+
});
|
53676
|
+
}, label);
|
53677
|
+
};
|
53678
|
+
|
53679
|
+
return Promise;
|
53680
|
+
}();
|
53766
53681
|
|
53767
53682
|
Promise.cast = resolve$1; // deprecated
|
53768
53683
|
Promise.all = all;
|
@@ -54184,7 +54099,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
54184
54099
|
var promise = new Promise(noop);
|
54185
54100
|
|
54186
54101
|
args[l] = function (err, val) {
|
54187
|
-
if (err) reject(promise, err);else if (options === undefined) resolve(promise, val);else if (options === true) resolve(promise, arrayResult(arguments));else if (isArray(options)) resolve(promise, makeObject(arguments, options));else resolve(promise, val);
|
54102
|
+
if (err) reject(promise, err);else if (options === undefined) resolve(promise, val);else if (options === true) resolve(promise, arrayResult(arguments));else if (Array.isArray(options)) resolve(promise, makeObject(arguments, options));else resolve(promise, val);
|
54188
54103
|
};
|
54189
54104
|
|
54190
54105
|
if (promiseInput) {
|
@@ -54255,7 +54170,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
54255
54170
|
return AllSettled;
|
54256
54171
|
}(Enumerator);
|
54257
54172
|
|
54258
|
-
AllSettled.prototype.
|
54173
|
+
AllSettled.prototype._setResultAt = setSettledResult;
|
54259
54174
|
|
54260
54175
|
/**
|
54261
54176
|
`RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing
|
@@ -54303,7 +54218,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
54303
54218
|
*/
|
54304
54219
|
|
54305
54220
|
function allSettled(entries, label) {
|
54306
|
-
if (!isArray(entries)) {
|
54221
|
+
if (!Array.isArray(entries)) {
|
54307
54222
|
return Promise.reject(new TypeError("Promise.allSettled must be called with an array"), label);
|
54308
54223
|
}
|
54309
54224
|
|
@@ -54460,7 +54375,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
54460
54375
|
have been fulfilled, or rejected if any of them become rejected.
|
54461
54376
|
*/
|
54462
54377
|
function hash(object, label) {
|
54463
|
-
if (
|
54378
|
+
if (object === null || typeof object !== 'object') {
|
54464
54379
|
return Promise.reject(new TypeError("Promise.hash must be called with an object"), label);
|
54465
54380
|
}
|
54466
54381
|
|
@@ -54478,7 +54393,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
54478
54393
|
return HashSettled;
|
54479
54394
|
}(PromiseHash);
|
54480
54395
|
|
54481
|
-
HashSettled.prototype.
|
54396
|
+
HashSettled.prototype._setResultAt = setSettledResult;
|
54482
54397
|
|
54483
54398
|
/**
|
54484
54399
|
`RSVP.hashSettled` is similar to `RSVP.allSettled`, but takes an object
|
@@ -54583,7 +54498,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
54583
54498
|
*/
|
54584
54499
|
|
54585
54500
|
function hashSettled(object, label) {
|
54586
|
-
if (
|
54501
|
+
if (object === null || typeof object !== 'object') {
|
54587
54502
|
return Promise.reject(new TypeError("RSVP.hashSettled must be called with an object"), label);
|
54588
54503
|
}
|
54589
54504
|
|
@@ -54681,12 +54596,46 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
54681
54596
|
return deferred;
|
54682
54597
|
}
|
54683
54598
|
|
54599
|
+
var MapEnumerator = function (_Enumerator3) {
|
54600
|
+
(0, _emberBabel.inherits)(MapEnumerator, _Enumerator3);
|
54601
|
+
|
54602
|
+
function MapEnumerator(Constructor, entries, mapFn, label) {
|
54603
|
+
(0, _emberBabel.classCallCheck)(this, MapEnumerator);
|
54604
|
+
return (0, _emberBabel.possibleConstructorReturn)(this, _Enumerator3.call(this, Constructor, entries, true, label, mapFn));
|
54605
|
+
}
|
54606
|
+
|
54607
|
+
MapEnumerator.prototype._init = function _init(Constructor, input, bool, label, mapFn) {
|
54608
|
+
var len = input.length || 0;
|
54609
|
+
this.length = len;
|
54610
|
+
this._remaining = len;
|
54611
|
+
this._result = new Array(len);
|
54612
|
+
this._mapFn = mapFn;
|
54613
|
+
|
54614
|
+
this._enumerate(input);
|
54615
|
+
};
|
54616
|
+
|
54617
|
+
MapEnumerator.prototype._setResultAt = function _setResultAt(state, i, value, firstPass) {
|
54618
|
+
if (firstPass) {
|
54619
|
+
var val = tryCatch(this._mapFn)(value, i);
|
54620
|
+
if (val === TRY_CATCH_ERROR) {
|
54621
|
+
this._settledAt(REJECTED, i, val.error, false);
|
54622
|
+
} else {
|
54623
|
+
this._eachEntry(val, i, false);
|
54624
|
+
}
|
54625
|
+
} else {
|
54626
|
+
this._remaining--;
|
54627
|
+
this._result[i] = value;
|
54628
|
+
}
|
54629
|
+
};
|
54630
|
+
|
54631
|
+
return MapEnumerator;
|
54632
|
+
}(Enumerator);
|
54633
|
+
|
54684
54634
|
/**
|
54685
|
-
`RSVP.map` is similar to JavaScript's native `map` method
|
54686
|
-
|
54687
|
-
|
54688
|
-
|
54689
|
-
become fulfilled with.
|
54635
|
+
`RSVP.map` is similar to JavaScript's native `map` method. `mapFn` is eagerly called
|
54636
|
+
meaning that as soon as any promise resolves its value will be passed to `mapFn`.
|
54637
|
+
`RSVP.map` returns a promise that will become fulfilled with the result of running
|
54638
|
+
`mapFn` on the values the promises become fulfilled with.
|
54690
54639
|
|
54691
54640
|
For example:
|
54692
54641
|
|
@@ -54760,24 +54709,15 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
54760
54709
|
@static
|
54761
54710
|
*/
|
54762
54711
|
function map(promises, mapFn, label) {
|
54763
|
-
if (!isArray(promises)) {
|
54712
|
+
if (!Array.isArray(promises)) {
|
54764
54713
|
return Promise.reject(new TypeError("RSVP.map must be called with an array"), label);
|
54765
54714
|
}
|
54766
54715
|
|
54767
|
-
if (
|
54716
|
+
if (typeof mapFn !== 'function') {
|
54768
54717
|
return Promise.reject(new TypeError("RSVP.map expects a function as a second argument"), label);
|
54769
54718
|
}
|
54770
54719
|
|
54771
|
-
return Promise
|
54772
|
-
var length = values.length;
|
54773
|
-
var results = new Array(length);
|
54774
|
-
|
54775
|
-
for (var i = 0; i < length; i++) {
|
54776
|
-
results[i] = mapFn(values[i]);
|
54777
|
-
}
|
54778
|
-
|
54779
|
-
return Promise.all(results, label);
|
54780
|
-
});
|
54720
|
+
return new MapEnumerator(Promise, promises, mapFn, label).promise;
|
54781
54721
|
}
|
54782
54722
|
|
54783
54723
|
/**
|
@@ -54811,12 +54751,62 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
54811
54751
|
return Promise.reject(reason, label);
|
54812
54752
|
}
|
54813
54753
|
|
54754
|
+
var EMPTY_OBJECT = {};
|
54755
|
+
|
54756
|
+
var FilterEnumerator = function (_Enumerator4) {
|
54757
|
+
(0, _emberBabel.inherits)(FilterEnumerator, _Enumerator4);
|
54758
|
+
|
54759
|
+
function FilterEnumerator(Constructor, entries, filterFn, label) {
|
54760
|
+
(0, _emberBabel.classCallCheck)(this, FilterEnumerator);
|
54761
|
+
return (0, _emberBabel.possibleConstructorReturn)(this, _Enumerator4.call(this, Constructor, entries, true, label, filterFn));
|
54762
|
+
}
|
54763
|
+
|
54764
|
+
FilterEnumerator.prototype._init = function _init(Constructor, input, bool, label, filterFn) {
|
54765
|
+
var len = input.length || 0;
|
54766
|
+
this.length = len;
|
54767
|
+
this._remaining = len;
|
54768
|
+
|
54769
|
+
this._result = new Array(len);
|
54770
|
+
this._filterFn = filterFn;
|
54771
|
+
|
54772
|
+
this._enumerate(input);
|
54773
|
+
};
|
54774
|
+
|
54775
|
+
FilterEnumerator.prototype._checkFullfillment = function _checkFullfillment() {
|
54776
|
+
if (this._remaining === 0) {
|
54777
|
+
this._result = this._result.filter(function (val) {
|
54778
|
+
return val !== EMPTY_OBJECT;
|
54779
|
+
});
|
54780
|
+
fulfill(this.promise, this._result);
|
54781
|
+
}
|
54782
|
+
};
|
54783
|
+
|
54784
|
+
FilterEnumerator.prototype._setResultAt = function _setResultAt(state, i, value, firstPass) {
|
54785
|
+
if (firstPass) {
|
54786
|
+
this._result[i] = value;
|
54787
|
+
var val = tryCatch(this._filterFn)(value, i);
|
54788
|
+
if (val === TRY_CATCH_ERROR) {
|
54789
|
+
this._settledAt(REJECTED, i, val.error, false);
|
54790
|
+
} else {
|
54791
|
+
this._eachEntry(val, i, false);
|
54792
|
+
}
|
54793
|
+
} else {
|
54794
|
+
this._remaining--;
|
54795
|
+
if (!value) {
|
54796
|
+
this._result[i] = EMPTY_OBJECT;
|
54797
|
+
}
|
54798
|
+
}
|
54799
|
+
};
|
54800
|
+
|
54801
|
+
return FilterEnumerator;
|
54802
|
+
}(Enumerator);
|
54803
|
+
|
54814
54804
|
/**
|
54815
|
-
`RSVP.filter` is similar to JavaScript's native `filter` method
|
54816
|
-
|
54817
|
-
|
54818
|
-
become fulfilled with the result of running
|
54819
|
-
promises become fulfilled with.
|
54805
|
+
`RSVP.filter` is similar to JavaScript's native `filter` method.
|
54806
|
+
`filterFn` is eagerly called meaning that as soon as any promise
|
54807
|
+
resolves its value will be passed to `filterFn`. `RSVP.filter` returns
|
54808
|
+
a promise that will become fulfilled with the result of running
|
54809
|
+
`filterFn` on the values the promises become fulfilled with.
|
54820
54810
|
|
54821
54811
|
For example:
|
54822
54812
|
|
@@ -54897,49 +54887,17 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
54897
54887
|
@return {Promise}
|
54898
54888
|
*/
|
54899
54889
|
|
54900
|
-
function resolveAll(promises, label) {
|
54901
|
-
return Promise.all(promises, label);
|
54902
|
-
}
|
54903
|
-
|
54904
|
-
function resolveSingle(promise, label) {
|
54905
|
-
return Promise.resolve(promise, label).then(function (promises) {
|
54906
|
-
return resolveAll(promises, label);
|
54907
|
-
});
|
54908
|
-
}
|
54909
|
-
|
54910
54890
|
function filter(promises, filterFn, label) {
|
54911
|
-
if (!isArray(promises) && !(
|
54891
|
+
if (!Array.isArray(promises) && !(promises !== null && typeof promises === 'object' && promises.then !== undefined)) {
|
54912
54892
|
return Promise.reject(new TypeError("RSVP.filter must be called with an array or promise"), label);
|
54913
54893
|
}
|
54914
54894
|
|
54915
|
-
if (
|
54895
|
+
if (typeof filterFn !== 'function') {
|
54916
54896
|
return Promise.reject(new TypeError("RSVP.filter expects function as a second argument"), label);
|
54917
54897
|
}
|
54918
54898
|
|
54919
|
-
|
54920
|
-
|
54921
|
-
var length = values.length;
|
54922
|
-
var filtered = new Array(length);
|
54923
|
-
|
54924
|
-
for (var i = 0; i < length; i++) {
|
54925
|
-
filtered[i] = filterFn(values[i]);
|
54926
|
-
}
|
54927
|
-
|
54928
|
-
return resolveAll(filtered, label).then(function (filtered) {
|
54929
|
-
var results = new Array(length);
|
54930
|
-
var newLength = 0;
|
54931
|
-
|
54932
|
-
for (var _i = 0; _i < length; _i++) {
|
54933
|
-
if (filtered[_i]) {
|
54934
|
-
results[newLength] = values[_i];
|
54935
|
-
newLength++;
|
54936
|
-
}
|
54937
|
-
}
|
54938
|
-
|
54939
|
-
results.length = newLength;
|
54940
|
-
|
54941
|
-
return results;
|
54942
|
-
});
|
54899
|
+
return Promise.resolve(promises, label).then(function (promises) {
|
54900
|
+
return new FilterEnumerator(Promise, promises, filterFn, label).promise;
|
54943
54901
|
});
|
54944
54902
|
}
|
54945
54903
|
|