ember-source 2.16.1 → 2.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.prod.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;
|
@@ -5307,14 +5307,15 @@ enifed('@glimmer/runtime', ['exports', '@glimmer/util', '@glimmer/reference', '@
|
|
5307
5307
|
value;
|
5308
5308
|
var partialSymbols = partial.symbolTable.symbols;
|
5309
5309
|
var outerScope = vm.scope();
|
5310
|
+
var evalScope = outerScope.getEvalScope();
|
5310
5311
|
var partialScope = vm.pushRootScope(partialSymbols.length, false);
|
5311
5312
|
partialScope.bindCallerScope(outerScope.getCallerScope());
|
5312
|
-
partialScope.bindEvalScope(
|
5313
|
+
partialScope.bindEvalScope(evalScope);
|
5313
5314
|
partialScope.bindSelf(outerScope.getSelf());
|
5314
5315
|
var evalInfo = this.evalInfo,
|
5315
5316
|
outerSymbols = this.outerSymbols;
|
5316
5317
|
|
5317
|
-
var locals = (
|
5318
|
+
var locals = Object.create(outerScope.getPartialMap());
|
5318
5319
|
for (i = 0; i < evalInfo.length; i++) {
|
5319
5320
|
slot = evalInfo[i];
|
5320
5321
|
name = outerSymbols[slot - 1];
|
@@ -5322,13 +5323,14 @@ enifed('@glimmer/runtime', ['exports', '@glimmer/util', '@glimmer/reference', '@
|
|
5322
5323
|
|
5323
5324
|
locals[name] = ref;
|
5324
5325
|
}
|
5325
|
-
|
5326
|
-
|
5327
|
-
|
5328
|
-
|
5329
|
-
|
5326
|
+
if (evalScope) {
|
5327
|
+
for (_i2 = 0; _i2 < partialSymbols.length; _i2++) {
|
5328
|
+
_name = partialSymbols[_i2];
|
5329
|
+
symbol = _i2 + 1;
|
5330
|
+
value = evalScope[_name];
|
5330
5331
|
|
5331
|
-
|
5332
|
+
if (value !== undefined) partialScope.bind(symbol, value);
|
5333
|
+
}
|
5332
5334
|
}
|
5333
5335
|
partialScope.bindPartialMap(locals);
|
5334
5336
|
vm.pushFrame();
|
@@ -44546,7 +44548,7 @@ enifed('ember/index', ['exports', 'require', 'ember-environment', 'node-module',
|
|
44546
44548
|
enifed("ember/version", ["exports"], function (exports) {
|
44547
44549
|
"use strict";
|
44548
44550
|
|
44549
|
-
exports.default = "2.16.
|
44551
|
+
exports.default = "2.16.2";
|
44550
44552
|
});
|
44551
44553
|
enifed('node-module', ['exports'], function(_exports) {
|
44552
44554
|
var IS_NODE = typeof module === 'object' && typeof module.require === 'function';
|
@@ -47605,18 +47607,6 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
47605
47607
|
|
47606
47608
|
var _rsvp, callbacks;
|
47607
47609
|
|
47608
|
-
function indexOf(callbacks, callback) {
|
47609
|
-
var i, l;
|
47610
|
-
|
47611
|
-
for (i = 0, l = callbacks.length; i < l; i++) {
|
47612
|
-
if (callbacks[i] === callback) {
|
47613
|
-
return i;
|
47614
|
-
}
|
47615
|
-
}
|
47616
|
-
|
47617
|
-
return -1;
|
47618
|
-
}
|
47619
|
-
|
47620
47610
|
function callbacksFor(object) {
|
47621
47611
|
var callbacks = object._promiseCallbacks;
|
47622
47612
|
|
@@ -47652,7 +47642,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
47652
47642
|
callbacks = allCallbacks[eventName] = [];
|
47653
47643
|
}
|
47654
47644
|
|
47655
|
-
if (indexOf(
|
47645
|
+
if (callbacks.indexOf(callback)) {
|
47656
47646
|
callbacks.push(callback);
|
47657
47647
|
}
|
47658
47648
|
},
|
@@ -47668,7 +47658,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
47668
47658
|
|
47669
47659
|
callbacks = allCallbacks[eventName];
|
47670
47660
|
|
47671
|
-
index = indexOf(
|
47661
|
+
index = callbacks.indexOf(callback);
|
47672
47662
|
|
47673
47663
|
if (index !== -1) {
|
47674
47664
|
callbacks.splice(index, 1);
|
@@ -47705,40 +47695,6 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
47705
47695
|
}
|
47706
47696
|
}
|
47707
47697
|
|
47708
|
-
function objectOrFunction(x) {
|
47709
|
-
var type = typeof x;
|
47710
|
-
return x !== null && (type === 'object' || type === 'function');
|
47711
|
-
}
|
47712
|
-
|
47713
|
-
function isFunction(x) {
|
47714
|
-
return typeof x === 'function';
|
47715
|
-
}
|
47716
|
-
|
47717
|
-
function isObject(x) {
|
47718
|
-
return x !== null && typeof x === 'object';
|
47719
|
-
}
|
47720
|
-
|
47721
|
-
function isMaybeThenable(x) {
|
47722
|
-
return x !== null && typeof x === 'object';
|
47723
|
-
}
|
47724
|
-
|
47725
|
-
var _isArray = void 0;
|
47726
|
-
if (Array.isArray) {
|
47727
|
-
_isArray = Array.isArray;
|
47728
|
-
} else {
|
47729
|
-
_isArray = function (x) {
|
47730
|
-
return Object.prototype.toString.call(x) === '[object Array]';
|
47731
|
-
};
|
47732
|
-
}
|
47733
|
-
|
47734
|
-
var isArray = _isArray;
|
47735
|
-
|
47736
|
-
// Date.now is not available in browsers < IE9
|
47737
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
|
47738
|
-
var now = Date.now || function () {
|
47739
|
-
return new Date().getTime();
|
47740
|
-
};
|
47741
|
-
|
47742
47698
|
var queue = [];
|
47743
47699
|
|
47744
47700
|
function scheduleFlush() {
|
@@ -47772,7 +47728,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
47772
47728
|
detail: promise._result,
|
47773
47729
|
childId: child && child._id,
|
47774
47730
|
label: promise._label,
|
47775
|
-
timeStamp: now(),
|
47731
|
+
timeStamp: Date.now(),
|
47776
47732
|
error: config["instrument-with-stack"] ? new Error(promise._label) : null
|
47777
47733
|
} })) {
|
47778
47734
|
scheduleFlush();
|
@@ -47828,12 +47784,21 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
47828
47784
|
return new TypeError('A promises callback cannot return that same promise.');
|
47829
47785
|
}
|
47830
47786
|
|
47787
|
+
function objectOrFunction(x) {
|
47788
|
+
var type = typeof x;
|
47789
|
+
return x !== null && (type === 'object' || type === 'function');
|
47790
|
+
}
|
47791
|
+
|
47831
47792
|
function noop() {}
|
47832
47793
|
|
47833
47794
|
var PENDING = void 0;
|
47834
47795
|
var FULFILLED = 1;
|
47835
47796
|
var REJECTED = 2;
|
47836
47797
|
|
47798
|
+
function ErrorObject() {
|
47799
|
+
this.error = null;
|
47800
|
+
}
|
47801
|
+
|
47837
47802
|
var GET_THEN_ERROR = new ErrorObject();
|
47838
47803
|
|
47839
47804
|
function getThen(promise) {
|
@@ -47845,6 +47810,28 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
47845
47810
|
}
|
47846
47811
|
}
|
47847
47812
|
|
47813
|
+
var TRY_CATCH_ERROR = new ErrorObject();
|
47814
|
+
|
47815
|
+
var tryCatchCallback = void 0;
|
47816
|
+
function tryCatcher() {
|
47817
|
+
var target;
|
47818
|
+
|
47819
|
+
try {
|
47820
|
+
target = tryCatchCallback;
|
47821
|
+
|
47822
|
+
tryCatchCallback = null;
|
47823
|
+
return target.apply(this, arguments);
|
47824
|
+
} catch (e) {
|
47825
|
+
TRY_CATCH_ERROR.error = e;
|
47826
|
+
return TRY_CATCH_ERROR;
|
47827
|
+
}
|
47828
|
+
}
|
47829
|
+
|
47830
|
+
function tryCatch(fn) {
|
47831
|
+
tryCatchCallback = fn;
|
47832
|
+
return tryCatcher;
|
47833
|
+
}
|
47834
|
+
|
47848
47835
|
function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
|
47849
47836
|
try {
|
47850
47837
|
then$$1.call(value, fulfillmentHandler, rejectionHandler);
|
@@ -47890,10 +47877,10 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
47890
47877
|
reject(promise, thenable._result);
|
47891
47878
|
} else {
|
47892
47879
|
subscribe(thenable, undefined, function (value) {
|
47893
|
-
if (thenable
|
47894
|
-
resolve(promise, value, undefined);
|
47895
|
-
} else {
|
47880
|
+
if (thenable === value) {
|
47896
47881
|
fulfill(promise, value);
|
47882
|
+
} else {
|
47883
|
+
resolve(promise, value);
|
47897
47884
|
}
|
47898
47885
|
}, function (reason) {
|
47899
47886
|
return reject(promise, reason);
|
@@ -47902,14 +47889,17 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
47902
47889
|
}
|
47903
47890
|
|
47904
47891
|
function handleMaybeThenable(promise, maybeThenable, then$$1) {
|
47905
|
-
var isOwnThenable = maybeThenable.constructor === promise.constructor && then$$1 === then && promise.constructor.resolve === resolve$1
|
47892
|
+
var isOwnThenable = maybeThenable.constructor === promise.constructor && then$$1 === then && promise.constructor.resolve === resolve$1,
|
47893
|
+
error;
|
47906
47894
|
|
47907
47895
|
if (isOwnThenable) {
|
47908
47896
|
handleOwnThenable(promise, maybeThenable);
|
47909
47897
|
} else if (then$$1 === GET_THEN_ERROR) {
|
47910
|
-
|
47898
|
+
error = GET_THEN_ERROR.error;
|
47899
|
+
|
47911
47900
|
GET_THEN_ERROR.error = null;
|
47912
|
-
|
47901
|
+
reject(promise, error);
|
47902
|
+
} else if (typeof then$$1 === 'function') {
|
47913
47903
|
handleForeignThenable(promise, maybeThenable, then$$1);
|
47914
47904
|
} else {
|
47915
47905
|
fulfill(promise, maybeThenable);
|
@@ -48006,46 +47996,28 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
48006
47996
|
promise._subscribers.length = 0;
|
48007
47997
|
}
|
48008
47998
|
|
48009
|
-
function ErrorObject() {
|
48010
|
-
this.error = null;
|
48011
|
-
}
|
48012
|
-
|
48013
|
-
var TRY_CATCH_ERROR = new ErrorObject();
|
48014
|
-
|
48015
|
-
function tryCatch(callback, result) {
|
48016
|
-
try {
|
48017
|
-
return callback(result);
|
48018
|
-
} catch (e) {
|
48019
|
-
TRY_CATCH_ERROR.error = e;
|
48020
|
-
return TRY_CATCH_ERROR;
|
48021
|
-
}
|
48022
|
-
}
|
48023
|
-
|
48024
47999
|
function invokeCallback(state, promise, callback, result) {
|
48025
|
-
var hasCallback =
|
48026
|
-
|
48027
|
-
|
48000
|
+
var hasCallback = typeof callback === 'function',
|
48001
|
+
error;
|
48002
|
+
var value = void 0;
|
48028
48003
|
|
48029
48004
|
if (hasCallback) {
|
48030
|
-
value = tryCatch(callback
|
48031
|
-
|
48032
|
-
if (value === TRY_CATCH_ERROR) {
|
48033
|
-
error = value.error;
|
48034
|
-
value.error = null; // release
|
48035
|
-
} else if (value === promise) {
|
48036
|
-
reject(promise, withOwnPromise());
|
48037
|
-
return;
|
48038
|
-
}
|
48005
|
+
value = tryCatch(callback)(result);
|
48039
48006
|
} else {
|
48040
48007
|
value = result;
|
48041
48008
|
}
|
48042
48009
|
|
48043
48010
|
if (promise._state !== PENDING) {
|
48044
48011
|
// noop
|
48045
|
-
} else if (
|
48046
|
-
|
48047
|
-
} else if (
|
48012
|
+
} else if (value === promise) {
|
48013
|
+
reject(promise, withOwnPromise());
|
48014
|
+
} else if (value === TRY_CATCH_ERROR) {
|
48015
|
+
error = value.error;
|
48016
|
+
|
48017
|
+
value.error = null; // release
|
48048
48018
|
reject(promise, error);
|
48019
|
+
} else if (hasCallback) {
|
48020
|
+
resolve(promise, value);
|
48049
48021
|
} else if (state === FULFILLED) {
|
48050
48022
|
fulfill(promise, value);
|
48051
48023
|
} else if (state === REJECTED) {
|
@@ -48104,114 +48076,122 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
48104
48076
|
return child;
|
48105
48077
|
}
|
48106
48078
|
|
48107
|
-
|
48108
|
-
|
48109
|
-
this.promise = new Constructor(noop, label);
|
48110
|
-
this._abortOnReject = abortOnReject;
|
48079
|
+
var Enumerator = function () {
|
48080
|
+
function Enumerator(Constructor, input, abortOnReject, label) {
|
48111
48081
|
|
48112
|
-
|
48113
|
-
|
48114
|
-
|
48115
|
-
|
48116
|
-
var len = input.length || 0;
|
48117
|
-
this.length = len;
|
48118
|
-
this._remaining = len;
|
48119
|
-
this._result = new Array(len);
|
48082
|
+
this._instanceConstructor = Constructor;
|
48083
|
+
this.promise = new Constructor(noop, label);
|
48084
|
+
this._abortOnReject = abortOnReject;
|
48085
|
+
this.isUsingOwnPromise = Constructor === Promise;
|
48120
48086
|
|
48121
|
-
|
48122
|
-
if (this._remaining === 0) {
|
48123
|
-
fulfill(this.promise, this._result);
|
48087
|
+
this._init.apply(this, arguments);
|
48124
48088
|
}
|
48125
|
-
};
|
48126
48089
|
|
48127
|
-
|
48128
|
-
|
48129
|
-
|
48130
|
-
|
48090
|
+
Enumerator.prototype._init = function (Constructor, input) {
|
48091
|
+
var len = input.length || 0;
|
48092
|
+
this.length = len;
|
48093
|
+
this._remaining = len;
|
48094
|
+
this._result = new Array(len);
|
48131
48095
|
|
48132
|
-
|
48133
|
-
|
48134
|
-
}
|
48135
|
-
};
|
48096
|
+
this._enumerate(input);
|
48097
|
+
};
|
48136
48098
|
|
48137
|
-
|
48138
|
-
|
48139
|
-
|
48140
|
-
|
48141
|
-
var resolve$$1 = c.resolve;
|
48099
|
+
Enumerator.prototype._enumerate = function (input) {
|
48100
|
+
var length = this.length,
|
48101
|
+
i;
|
48102
|
+
var promise = this.promise;
|
48142
48103
|
|
48143
|
-
|
48144
|
-
|
48104
|
+
for (i = 0; promise._state === PENDING && i < length; i++) {
|
48105
|
+
this._eachEntry(input[i], i, true);
|
48106
|
+
}
|
48145
48107
|
|
48108
|
+
this._checkFullfillment();
|
48109
|
+
};
|
48146
48110
|
|
48147
|
-
|
48148
|
-
|
48149
|
-
this.
|
48150
|
-
}
|
48151
|
-
|
48152
|
-
|
48153
|
-
|
48154
|
-
|
48111
|
+
Enumerator.prototype._checkFullfillment = function () {
|
48112
|
+
if (this._remaining === 0) {
|
48113
|
+
fulfill(this.promise, this._result);
|
48114
|
+
}
|
48115
|
+
};
|
48116
|
+
|
48117
|
+
Enumerator.prototype._settleMaybeThenable = function (entry, i, firstPass) {
|
48118
|
+
var c = this._instanceConstructor,
|
48119
|
+
then$$1,
|
48120
|
+
promise;
|
48121
|
+
var resolve$$1 = c.resolve;
|
48122
|
+
|
48123
|
+
if (resolve$$1 === resolve$1) {
|
48124
|
+
then$$1 = getThen(entry);
|
48125
|
+
|
48126
|
+
|
48127
|
+
if (then$$1 === then && entry._state !== PENDING) {
|
48128
|
+
entry._onError = null;
|
48129
|
+
this._settledAt(entry._state, i, entry._result, firstPass);
|
48130
|
+
} else if (typeof then$$1 !== 'function') {
|
48131
|
+
this._settledAt(FULFILLED, i, entry, firstPass);
|
48132
|
+
} else if (this.isUsingOwnPromise) {
|
48133
|
+
promise = new c(noop);
|
48155
48134
|
|
48156
|
-
|
48157
|
-
|
48135
|
+
handleMaybeThenable(promise, entry, then$$1);
|
48136
|
+
this._willSettleAt(promise, i, firstPass);
|
48137
|
+
} else {
|
48138
|
+
this._willSettleAt(new c(function (resolve$$1) {
|
48139
|
+
return resolve$$1(entry);
|
48140
|
+
}), i, firstPass);
|
48141
|
+
}
|
48158
48142
|
} else {
|
48159
|
-
this._willSettleAt(
|
48160
|
-
return resolve$$1(entry);
|
48161
|
-
}), i);
|
48143
|
+
this._willSettleAt(resolve$$1(entry), i, firstPass);
|
48162
48144
|
}
|
48163
|
-
}
|
48164
|
-
this._willSettleAt(resolve$$1(entry), i);
|
48165
|
-
}
|
48166
|
-
};
|
48145
|
+
};
|
48167
48146
|
|
48168
|
-
|
48169
|
-
|
48170
|
-
|
48171
|
-
|
48172
|
-
|
48173
|
-
|
48174
|
-
}
|
48175
|
-
};
|
48147
|
+
Enumerator.prototype._eachEntry = function (entry, i, firstPass) {
|
48148
|
+
if (entry !== null && typeof entry === 'object') {
|
48149
|
+
this._settleMaybeThenable(entry, i, firstPass);
|
48150
|
+
} else {
|
48151
|
+
this._setResultAt(FULFILLED, i, entry, firstPass);
|
48152
|
+
}
|
48153
|
+
};
|
48176
48154
|
|
48177
|
-
|
48178
|
-
|
48155
|
+
Enumerator.prototype._settledAt = function (state, i, value, firstPass) {
|
48156
|
+
var promise = this.promise;
|
48179
48157
|
|
48180
|
-
|
48181
|
-
|
48182
|
-
|
48183
|
-
|
48184
|
-
|
48185
|
-
|
48186
|
-
if (this._remaining === 0) {
|
48187
|
-
fulfill(promise, this._result);
|
48158
|
+
if (promise._state === PENDING) {
|
48159
|
+
if (this._abortOnReject && state === REJECTED) {
|
48160
|
+
reject(promise, value);
|
48161
|
+
} else {
|
48162
|
+
this._setResultAt(state, i, value, firstPass);
|
48163
|
+
this._checkFullfillment();
|
48188
48164
|
}
|
48189
48165
|
}
|
48190
|
-
}
|
48191
|
-
};
|
48166
|
+
};
|
48192
48167
|
|
48193
|
-
|
48194
|
-
|
48195
|
-
|
48168
|
+
Enumerator.prototype._setResultAt = function (state, i, value) {
|
48169
|
+
this._remaining--;
|
48170
|
+
this._result[i] = value;
|
48171
|
+
};
|
48196
48172
|
|
48197
|
-
|
48198
|
-
|
48173
|
+
Enumerator.prototype._willSettleAt = function (promise, i, firstPass) {
|
48174
|
+
var _this = this;
|
48199
48175
|
|
48200
|
-
|
48201
|
-
|
48202
|
-
|
48203
|
-
|
48204
|
-
|
48205
|
-
|
48176
|
+
subscribe(promise, undefined, function (value) {
|
48177
|
+
return _this._settledAt(FULFILLED, i, value, firstPass);
|
48178
|
+
}, function (reason) {
|
48179
|
+
return _this._settledAt(REJECTED, i, reason, firstPass);
|
48180
|
+
});
|
48181
|
+
};
|
48182
|
+
|
48183
|
+
return Enumerator;
|
48184
|
+
}();
|
48206
48185
|
|
48207
|
-
function
|
48186
|
+
function setSettledResult(state, i, value) {
|
48187
|
+
this._remaining--;
|
48208
48188
|
if (state === FULFILLED) {
|
48209
|
-
|
48189
|
+
this._result[i] = {
|
48210
48190
|
state: 'fulfilled',
|
48211
48191
|
value: value
|
48212
48192
|
};
|
48213
48193
|
} else {
|
48214
|
-
|
48194
|
+
this._result[i] = {
|
48215
48195
|
state: 'rejected',
|
48216
48196
|
reason: value
|
48217
48197
|
};
|
@@ -48372,7 +48352,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
48372
48352
|
*/
|
48373
48353
|
|
48374
48354
|
|
48375
|
-
var guidKey = 'rsvp_' + now() + '-';
|
48355
|
+
var guidKey = 'rsvp_' + Date.now() + '-';
|
48376
48356
|
var counter = 0;
|
48377
48357
|
|
48378
48358
|
function needsResolver() {
|
@@ -48487,121 +48467,59 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
48487
48467
|
Useful for tooling.
|
48488
48468
|
@constructor
|
48489
48469
|
*/
|
48490
|
-
function Promise(resolver, label) {
|
48491
|
-
this._id = counter++;
|
48492
|
-
this._label = label;
|
48493
|
-
this._state = undefined;
|
48494
|
-
this._result = undefined;
|
48495
|
-
this._subscribers = [];
|
48496
48470
|
|
48497
|
-
|
48471
|
+
var Promise = function () {
|
48472
|
+
function Promise(resolver, label) {
|
48498
48473
|
|
48499
|
-
|
48500
|
-
|
48501
|
-
this
|
48502
|
-
|
48503
|
-
|
48474
|
+
this._id = counter++;
|
48475
|
+
this._label = label;
|
48476
|
+
this._state = undefined;
|
48477
|
+
this._result = undefined;
|
48478
|
+
this._subscribers = [];
|
48504
48479
|
|
48505
|
-
|
48506
|
-
var _this = this;
|
48480
|
+
config.instrument && instrument('created', this);
|
48507
48481
|
|
48508
|
-
|
48509
|
-
|
48510
|
-
|
48482
|
+
if (noop !== resolver) {
|
48483
|
+
typeof resolver !== 'function' && needsResolver();
|
48484
|
+
this instanceof Promise ? initializePromise(this, resolver) : needsNew();
|
48511
48485
|
}
|
48512
|
-
});
|
48513
|
-
};
|
48514
|
-
|
48515
|
-
/**
|
48516
|
-
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
|
48517
|
-
as the catch block of a try/catch statement.
|
48518
|
-
|
48519
|
-
```js
|
48520
|
-
function findAuthor(){
|
48521
|
-
throw new Error('couldn\'t find that author');
|
48522
|
-
}
|
48523
|
-
|
48524
|
-
// synchronous
|
48525
|
-
try {
|
48526
|
-
findAuthor();
|
48527
|
-
} catch(reason) {
|
48528
|
-
// something went wrong
|
48529
48486
|
}
|
48530
|
-
|
48531
|
-
// async with promises
|
48532
|
-
findAuthor().catch(function(reason){
|
48533
|
-
// something went wrong
|
48534
|
-
});
|
48535
|
-
```
|
48536
|
-
|
48537
|
-
@method catch
|
48538
|
-
@param {Function} onRejection
|
48539
|
-
@param {String} label optional string for labeling the promise.
|
48540
|
-
Useful for tooling.
|
48541
|
-
@return {Promise}
|
48542
|
-
*/
|
48543
|
-
Promise.prototype.catch = function (onRejection, label) {
|
48544
|
-
return this.then(undefined, onRejection, label);
|
48545
|
-
};
|
48546
48487
|
|
48547
|
-
|
48548
|
-
|
48549
|
-
try/catch/finally behaves
|
48550
|
-
|
48551
|
-
Synchronous example:
|
48552
|
-
|
48553
|
-
```js
|
48554
|
-
findAuthor() {
|
48555
|
-
if (Math.random() > 0.5) {
|
48556
|
-
throw new Error();
|
48557
|
-
}
|
48558
|
-
return new Author();
|
48559
|
-
}
|
48560
|
-
|
48561
|
-
try {
|
48562
|
-
return findAuthor(); // succeed or fail
|
48563
|
-
} catch(error) {
|
48564
|
-
return findOtherAuthor();
|
48565
|
-
} finally {
|
48566
|
-
// always runs
|
48567
|
-
// doesn't affect the return value
|
48568
|
-
}
|
48569
|
-
```
|
48570
|
-
|
48571
|
-
Asynchronous example:
|
48572
|
-
|
48573
|
-
```js
|
48574
|
-
findAuthor().catch(function(reason){
|
48575
|
-
return findOtherAuthor();
|
48576
|
-
}).finally(function(){
|
48577
|
-
// author was either found, or not
|
48578
|
-
});
|
48579
|
-
```
|
48580
|
-
|
48581
|
-
@method finally
|
48582
|
-
@param {Function} callback
|
48583
|
-
@param {String} label optional string for labeling the promise.
|
48584
|
-
Useful for tooling.
|
48585
|
-
@return {Promise}
|
48586
|
-
*/
|
48587
|
-
Promise.prototype.finally = function (callback, label) {
|
48588
|
-
var promise = this;
|
48589
|
-
var constructor = promise.constructor;
|
48488
|
+
Promise.prototype._onError = function (reason) {
|
48489
|
+
var _this2 = this;
|
48590
48490
|
|
48591
|
-
|
48592
|
-
|
48593
|
-
|
48594
|
-
|
48595
|
-
}, function (reason) {
|
48596
|
-
return constructor.resolve(callback()).then(function () {
|
48597
|
-
throw reason;
|
48491
|
+
config.after(function () {
|
48492
|
+
if (_this2._onError) {
|
48493
|
+
config.trigger('error', reason, _this2._label);
|
48494
|
+
}
|
48598
48495
|
});
|
48599
|
-
}
|
48600
|
-
|
48496
|
+
};
|
48497
|
+
|
48498
|
+
Promise.prototype.catch = function (onRejection, label) {
|
48499
|
+
return this.then(undefined, onRejection, label);
|
48500
|
+
};
|
48501
|
+
|
48502
|
+
Promise.prototype.finally = function (callback, label) {
|
48503
|
+
var promise = this;
|
48504
|
+
var constructor = promise.constructor;
|
48505
|
+
|
48506
|
+
return promise.then(function (value) {
|
48507
|
+
return constructor.resolve(callback()).then(function () {
|
48508
|
+
return value;
|
48509
|
+
});
|
48510
|
+
}, function (reason) {
|
48511
|
+
return constructor.resolve(callback()).then(function () {
|
48512
|
+
throw reason;
|
48513
|
+
});
|
48514
|
+
}, label);
|
48515
|
+
};
|
48516
|
+
|
48517
|
+
return Promise;
|
48518
|
+
}();
|
48601
48519
|
|
48602
48520
|
Promise.cast = resolve$1; // deprecated
|
48603
48521
|
Promise.all = function (entries, label) {
|
48604
|
-
if (!isArray(entries)) {
|
48522
|
+
if (!Array.isArray(entries)) {
|
48605
48523
|
return this.reject(new TypeError("Promise.all must be called with an array"), label);
|
48606
48524
|
}
|
48607
48525
|
return new Enumerator(this, entries, true /* abort on reject */, label).promise;
|
@@ -48613,7 +48531,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
48613
48531
|
|
48614
48532
|
var promise = new Constructor(noop, label);
|
48615
48533
|
|
48616
|
-
if (!isArray(entries)) {
|
48534
|
+
if (!Array.isArray(entries)) {
|
48617
48535
|
reject(promise, new TypeError('Promise.race must be called with an array'));
|
48618
48536
|
return promise;
|
48619
48537
|
}
|
@@ -49061,7 +48979,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
49061
48979
|
var promise = new Promise(noop);
|
49062
48980
|
|
49063
48981
|
args[l] = function (err, val) {
|
49064
|
-
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);
|
48982
|
+
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);
|
49065
48983
|
};
|
49066
48984
|
|
49067
48985
|
if (promiseInput) {
|
@@ -49130,7 +49048,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
49130
49048
|
return AllSettled;
|
49131
49049
|
}(Enumerator);
|
49132
49050
|
|
49133
|
-
AllSettled.prototype.
|
49051
|
+
AllSettled.prototype._setResultAt = setSettledResult;
|
49134
49052
|
|
49135
49053
|
/**
|
49136
49054
|
`RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing
|
@@ -49178,7 +49096,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
49178
49096
|
*/
|
49179
49097
|
|
49180
49098
|
function allSettled(entries, label) {
|
49181
|
-
if (!isArray(entries)) {
|
49099
|
+
if (!Array.isArray(entries)) {
|
49182
49100
|
return Promise.reject(new TypeError("Promise.allSettled must be called with an array"), label);
|
49183
49101
|
}
|
49184
49102
|
|
@@ -49336,7 +49254,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
49336
49254
|
have been fulfilled, or rejected if any of them become rejected.
|
49337
49255
|
*/
|
49338
49256
|
function hash(object, label) {
|
49339
|
-
if (
|
49257
|
+
if (object === null || typeof object !== 'object') {
|
49340
49258
|
return Promise.reject(new TypeError("Promise.hash must be called with an object"), label);
|
49341
49259
|
}
|
49342
49260
|
|
@@ -49353,7 +49271,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
49353
49271
|
return HashSettled;
|
49354
49272
|
}(PromiseHash);
|
49355
49273
|
|
49356
|
-
HashSettled.prototype.
|
49274
|
+
HashSettled.prototype._setResultAt = setSettledResult;
|
49357
49275
|
|
49358
49276
|
/**
|
49359
49277
|
`RSVP.hashSettled` is similar to `RSVP.allSettled`, but takes an object
|
@@ -49458,7 +49376,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
49458
49376
|
*/
|
49459
49377
|
|
49460
49378
|
function hashSettled(object, label) {
|
49461
|
-
if (
|
49379
|
+
if (object === null || typeof object !== 'object') {
|
49462
49380
|
return Promise.reject(new TypeError("RSVP.hashSettled must be called with an object"), label);
|
49463
49381
|
}
|
49464
49382
|
|
@@ -49556,12 +49474,48 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
49556
49474
|
return deferred;
|
49557
49475
|
}
|
49558
49476
|
|
49477
|
+
var MapEnumerator = function (_Enumerator3) {
|
49478
|
+
(0, _emberBabel.inherits)(MapEnumerator, _Enumerator3);
|
49479
|
+
|
49480
|
+
function MapEnumerator(Constructor, entries, mapFn, label) {
|
49481
|
+
return (0, _emberBabel.possibleConstructorReturn)(this, _Enumerator3.call(this, Constructor, entries, true, label, mapFn));
|
49482
|
+
}
|
49483
|
+
|
49484
|
+
MapEnumerator.prototype._init = function (Constructor, input, bool, label, mapFn) {
|
49485
|
+
var len = input.length || 0;
|
49486
|
+
this.length = len;
|
49487
|
+
this._remaining = len;
|
49488
|
+
this._result = new Array(len);
|
49489
|
+
this._mapFn = mapFn;
|
49490
|
+
|
49491
|
+
this._enumerate(input);
|
49492
|
+
};
|
49493
|
+
|
49494
|
+
MapEnumerator.prototype._setResultAt = function (state, i, value, firstPass) {
|
49495
|
+
var val;
|
49496
|
+
|
49497
|
+
if (firstPass) {
|
49498
|
+
val = tryCatch(this._mapFn)(value, i);
|
49499
|
+
|
49500
|
+
if (val === TRY_CATCH_ERROR) {
|
49501
|
+
this._settledAt(REJECTED, i, val.error, false);
|
49502
|
+
} else {
|
49503
|
+
this._eachEntry(val, i, false);
|
49504
|
+
}
|
49505
|
+
} else {
|
49506
|
+
this._remaining--;
|
49507
|
+
this._result[i] = value;
|
49508
|
+
}
|
49509
|
+
};
|
49510
|
+
|
49511
|
+
return MapEnumerator;
|
49512
|
+
}(Enumerator);
|
49513
|
+
|
49559
49514
|
/**
|
49560
|
-
`RSVP.map` is similar to JavaScript's native `map` method
|
49561
|
-
|
49562
|
-
|
49563
|
-
|
49564
|
-
become fulfilled with.
|
49515
|
+
`RSVP.map` is similar to JavaScript's native `map` method. `mapFn` is eagerly called
|
49516
|
+
meaning that as soon as any promise resolves its value will be passed to `mapFn`.
|
49517
|
+
`RSVP.map` returns a promise that will become fulfilled with the result of running
|
49518
|
+
`mapFn` on the values the promises become fulfilled with.
|
49565
49519
|
|
49566
49520
|
For example:
|
49567
49521
|
|
@@ -49635,25 +49589,15 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
49635
49589
|
@static
|
49636
49590
|
*/
|
49637
49591
|
function map(promises, mapFn, label) {
|
49638
|
-
if (!isArray(promises)) {
|
49592
|
+
if (!Array.isArray(promises)) {
|
49639
49593
|
return Promise.reject(new TypeError("RSVP.map must be called with an array"), label);
|
49640
49594
|
}
|
49641
49595
|
|
49642
|
-
if (
|
49596
|
+
if (typeof mapFn !== 'function') {
|
49643
49597
|
return Promise.reject(new TypeError("RSVP.map expects a function as a second argument"), label);
|
49644
49598
|
}
|
49645
49599
|
|
49646
|
-
return Promise
|
49647
|
-
var length = values.length,
|
49648
|
-
i;
|
49649
|
-
var results = new Array(length);
|
49650
|
-
|
49651
|
-
for (i = 0; i < length; i++) {
|
49652
|
-
results[i] = mapFn(values[i]);
|
49653
|
-
}
|
49654
|
-
|
49655
|
-
return Promise.all(results, label);
|
49656
|
-
});
|
49600
|
+
return new MapEnumerator(Promise, promises, mapFn, label).promise;
|
49657
49601
|
}
|
49658
49602
|
|
49659
49603
|
/**
|
@@ -49687,12 +49631,64 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
49687
49631
|
return Promise.reject(reason, label);
|
49688
49632
|
}
|
49689
49633
|
|
49634
|
+
var EMPTY_OBJECT = {};
|
49635
|
+
|
49636
|
+
var FilterEnumerator = function (_Enumerator4) {
|
49637
|
+
(0, _emberBabel.inherits)(FilterEnumerator, _Enumerator4);
|
49638
|
+
|
49639
|
+
function FilterEnumerator(Constructor, entries, filterFn, label) {
|
49640
|
+
return (0, _emberBabel.possibleConstructorReturn)(this, _Enumerator4.call(this, Constructor, entries, true, label, filterFn));
|
49641
|
+
}
|
49642
|
+
|
49643
|
+
FilterEnumerator.prototype._init = function (Constructor, input, bool, label, filterFn) {
|
49644
|
+
var len = input.length || 0;
|
49645
|
+
this.length = len;
|
49646
|
+
this._remaining = len;
|
49647
|
+
|
49648
|
+
this._result = new Array(len);
|
49649
|
+
this._filterFn = filterFn;
|
49650
|
+
|
49651
|
+
this._enumerate(input);
|
49652
|
+
};
|
49653
|
+
|
49654
|
+
FilterEnumerator.prototype._checkFullfillment = function () {
|
49655
|
+
if (this._remaining === 0) {
|
49656
|
+
this._result = this._result.filter(function (val) {
|
49657
|
+
return val !== EMPTY_OBJECT;
|
49658
|
+
});
|
49659
|
+
fulfill(this.promise, this._result);
|
49660
|
+
}
|
49661
|
+
};
|
49662
|
+
|
49663
|
+
FilterEnumerator.prototype._setResultAt = function (state, i, value, firstPass) {
|
49664
|
+
var val;
|
49665
|
+
|
49666
|
+
if (firstPass) {
|
49667
|
+
this._result[i] = value;
|
49668
|
+
val = tryCatch(this._filterFn)(value, i);
|
49669
|
+
|
49670
|
+
if (val === TRY_CATCH_ERROR) {
|
49671
|
+
this._settledAt(REJECTED, i, val.error, false);
|
49672
|
+
} else {
|
49673
|
+
this._eachEntry(val, i, false);
|
49674
|
+
}
|
49675
|
+
} else {
|
49676
|
+
this._remaining--;
|
49677
|
+
if (!value) {
|
49678
|
+
this._result[i] = EMPTY_OBJECT;
|
49679
|
+
}
|
49680
|
+
}
|
49681
|
+
};
|
49682
|
+
|
49683
|
+
return FilterEnumerator;
|
49684
|
+
}(Enumerator);
|
49685
|
+
|
49690
49686
|
/**
|
49691
|
-
`RSVP.filter` is similar to JavaScript's native `filter` method
|
49692
|
-
|
49693
|
-
|
49694
|
-
become fulfilled with the result of running
|
49695
|
-
promises become fulfilled with.
|
49687
|
+
`RSVP.filter` is similar to JavaScript's native `filter` method.
|
49688
|
+
`filterFn` is eagerly called meaning that as soon as any promise
|
49689
|
+
resolves its value will be passed to `filterFn`. `RSVP.filter` returns
|
49690
|
+
a promise that will become fulfilled with the result of running
|
49691
|
+
`filterFn` on the values the promises become fulfilled with.
|
49696
49692
|
|
49697
49693
|
For example:
|
49698
49694
|
|
@@ -49773,51 +49769,17 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
|
|
49773
49769
|
@return {Promise}
|
49774
49770
|
*/
|
49775
49771
|
|
49776
|
-
function resolveAll(promises, label) {
|
49777
|
-
return Promise.all(promises, label);
|
49778
|
-
}
|
49779
|
-
|
49780
|
-
function resolveSingle(promise, label) {
|
49781
|
-
return Promise.resolve(promise, label).then(function (promises) {
|
49782
|
-
return resolveAll(promises, label);
|
49783
|
-
});
|
49784
|
-
}
|
49785
|
-
|
49786
49772
|
function filter(promises, filterFn, label) {
|
49787
|
-
if (!isArray(promises) && !(
|
49773
|
+
if (!Array.isArray(promises) && !(promises !== null && typeof promises === 'object' && promises.then !== undefined)) {
|
49788
49774
|
return Promise.reject(new TypeError("RSVP.filter must be called with an array or promise"), label);
|
49789
49775
|
}
|
49790
49776
|
|
49791
|
-
if (
|
49777
|
+
if (typeof filterFn !== 'function') {
|
49792
49778
|
return Promise.reject(new TypeError("RSVP.filter expects function as a second argument"), label);
|
49793
49779
|
}
|
49794
49780
|
|
49795
|
-
|
49796
|
-
|
49797
|
-
var length = values.length,
|
49798
|
-
i;
|
49799
|
-
var filtered = new Array(length);
|
49800
|
-
|
49801
|
-
for (i = 0; i < length; i++) {
|
49802
|
-
filtered[i] = filterFn(values[i]);
|
49803
|
-
}
|
49804
|
-
|
49805
|
-
return resolveAll(filtered, label).then(function (filtered) {
|
49806
|
-
var results = new Array(length),
|
49807
|
-
_i;
|
49808
|
-
var newLength = 0;
|
49809
|
-
|
49810
|
-
for (_i = 0; _i < length; _i++) {
|
49811
|
-
if (filtered[_i]) {
|
49812
|
-
results[newLength] = values[_i];
|
49813
|
-
newLength++;
|
49814
|
-
}
|
49815
|
-
}
|
49816
|
-
|
49817
|
-
results.length = newLength;
|
49818
|
-
|
49819
|
-
return results;
|
49820
|
-
});
|
49781
|
+
return Promise.resolve(promises, label).then(function (promises) {
|
49782
|
+
return new FilterEnumerator(Promise, promises, filterFn, label).promise;
|
49821
49783
|
});
|
49822
49784
|
}
|
49823
49785
|
|