ember-source 2.15.3 → 2.16.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d9c2e2a101126c3a322fd93d1606aed1a7fe3b8
4
- data.tar.gz: e3c5e1c849b11bf6429b569948425059b1ff9b62
3
+ metadata.gz: 5d85b6e19b02f07d2dae48c38161c7ea10ecb2cc
4
+ data.tar.gz: 5abe67d6938b0132ef8ea2d1cfc1c7a3e46740d8
5
5
  SHA512:
6
- metadata.gz: 9541adab758053b8c3df503062fcaff08f519caec0ac1f54a3150d79bba731f749c969493010f7e928127a2ff0eda19b89a1ffd8250cf35d78d8ef3ef89347a4
7
- data.tar.gz: b36f1418998e8094b0dde17f062abc7d84e9fab8c4195676fb5f9994cd08894d70a65e1637661e4140e7e8dcec6e6d2fb2df563a52e5b530774a6fee95d63653
6
+ metadata.gz: ad9804f06f9c92728ee2387041926e39447c5c00974e565e715f94f15ca304ee427d54bae6afce4e2b891808010db35ac81ead7986542c492729856cd7252da4
7
+ data.tar.gz: 7f633d6f52adc0b262969b47b8547d71f0a279e23e8497c2c5f20ba2d08c3bd252abdc19578626a5851f4c8ac64762b7dd9ac1c6c85955aca451f0fb9ec7a995
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.15.3
1
+ 2.16.0.beta.1
@@ -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.15.3
9
+ * @version 2.16.0-beta.1
10
10
  */
11
11
 
12
12
  var enifed, requireModule, Ember;
@@ -185,19 +185,17 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
185
185
  if (options.source) {
186
186
  var expandedFullName = this.registry.expandLocalLookup(fullName, options);
187
187
  // if expandLocalLookup returns falsey, we do not support local lookup
188
- if (_features.EMBER_MODULE_UNIFICATION) {
189
- if (expandedFullName) {
190
- // with ember-module-unification, if expandLocalLookup returns something,
191
- // pass it to the resolve without the source
192
- normalizedName = expandedFullName;
193
- options = {};
194
- }
195
- } else {
188
+ if (!_features.EMBER_MODULE_UNIFICATION) {
196
189
  if (!expandedFullName) {
197
190
  return;
198
191
  }
199
192
 
200
193
  normalizedName = expandedFullName;
194
+ } else if (expandedFullName) {
195
+ // with ember-module-unification, if expandLocalLookup returns something,
196
+ // pass it to the resolve without the source
197
+ normalizedName = expandedFullName;
198
+ options = {};
201
199
  }
202
200
  }
203
201
 
@@ -208,12 +206,7 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
208
206
  return cached;
209
207
  }
210
208
 
211
- var factory = void 0;
212
- if (_features.EMBER_MODULE_UNIFICATION) {
213
- factory = this.registry.resolve(normalizedName, options);
214
- } else {
215
- factory = this.registry.resolve(normalizedName);
216
- }
209
+ var factory = _features.EMBER_MODULE_UNIFICATION ? this.registry.resolve(normalizedName, options) : this.registry.resolve(normalizedName);
217
210
 
218
211
  if (factory === undefined) {
219
212
  return;
@@ -277,20 +270,18 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
277
270
  if (options.source) {
278
271
  var expandedFullName = container.registry.expandLocalLookup(fullName, options);
279
272
 
280
- if (_features.EMBER_MODULE_UNIFICATION) {
281
- if (expandedFullName) {
282
- // with ember-module-unification, if expandLocalLookup returns something,
283
- // pass it to the resolve without the source
284
- fullName = expandedFullName;
285
- options = {};
286
- }
287
- } else {
273
+ if (!_features.EMBER_MODULE_UNIFICATION) {
288
274
  // if expandLocalLookup returns falsey, we do not support local lookup
289
275
  if (!expandedFullName) {
290
276
  return;
291
277
  }
292
278
 
293
279
  fullName = expandedFullName;
280
+ } else if (expandedFullName) {
281
+ // with ember-module-unification, if expandLocalLookup returns something,
282
+ // pass it to the resolve without the source
283
+ fullName = expandedFullName;
284
+ options = {};
294
285
  }
295
286
  }
296
287
 
@@ -332,17 +323,7 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
332
323
  }
333
324
 
334
325
  function instantiateFactory(container, fullName, options) {
335
-
336
- var factoryManager = void 0;
337
- if (_features.EMBER_MODULE_UNIFICATION) {
338
- if (options && options.source) {
339
- factoryManager = container.factoryFor(fullName, options);
340
- } else {
341
- factoryManager = container.factoryFor(fullName);
342
- }
343
- } else {
344
- factoryManager = container.factoryFor(fullName);
345
- }
326
+ var factoryManager = _features.EMBER_MODULE_UNIFICATION && options && options.source ? container.factoryFor(fullName, options) : container.factoryFor(fullName);
346
327
 
347
328
  if (factoryManager === undefined) {
348
329
  return;
@@ -862,11 +843,11 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
862
843
  return injections;
863
844
  },
864
845
  resolverCacheKey: function (name, options) {
865
- if (_features.EMBER_MODULE_UNIFICATION) {
866
- return options && options.source ? options.source + ':' + name : name;
867
- } else {
846
+ if (!_features.EMBER_MODULE_UNIFICATION) {
868
847
  return name;
869
848
  }
849
+
850
+ return options && options.source ? options.source + ':' + name : name;
870
851
  }
871
852
  };
872
853
 
@@ -955,20 +936,18 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
955
936
  // and source into the full normalizedName
956
937
  var expandedNormalizedName = registry.expandLocalLookup(normalizedName, options);
957
938
 
958
- if (_features.EMBER_MODULE_UNIFICATION) {
959
- if (expandedNormalizedName) {
960
- // with ember-module-unification, if expandLocalLookup returns something,
961
- // pass it to the resolve without the source
962
- normalizedName = expandedNormalizedName;
963
- options = {};
964
- }
965
- } else {
966
- // if expandLocalLookup returns falsey, we do not support local lookup
939
+ // if expandLocalLookup returns falsey, we do not support local lookup
940
+ if (!_features.EMBER_MODULE_UNIFICATION) {
967
941
  if (!expandedNormalizedName) {
968
942
  return;
969
943
  }
970
944
 
971
945
  normalizedName = expandedNormalizedName;
946
+ } else if (expandedNormalizedName) {
947
+ // with ember-module-unification, if expandLocalLookup returns something,
948
+ // pass it to the resolve without the source
949
+ normalizedName = expandedNormalizedName;
950
+ options = {};
972
951
  }
973
952
  }
974
953
 
@@ -1621,46 +1600,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1621
1600
 
1622
1601
  */
1623
1602
 
1624
- function indexOf(array, target, method) {
1625
- var index = -1;
1626
- // hashes are added to the end of the event array
1627
- // so it makes sense to start searching at the end
1628
- // of the array and search in reverse
1629
- for (var i = array.length - 3; i >= 0; i -= 3) {
1630
- if (target === array[i] && method === array[i + 1]) {
1631
- index = i;
1632
- break;
1633
- }
1634
- }
1635
- return index;
1636
- }
1637
-
1638
- function accumulateListeners(obj, eventName, otherActions) {
1639
- var meta$$1 = exports.peekMeta(obj);
1640
- if (!meta$$1) {
1641
- return;
1642
- }
1643
- var actions = meta$$1.matchingListeners(eventName);
1644
- if (actions === undefined) {
1645
- return;
1646
- }
1647
- var newActions = [];
1648
-
1649
- for (var i = actions.length - 3; i >= 0; i -= 3) {
1650
- var target = actions[i];
1651
- var method = actions[i + 1];
1652
- var flags = actions[i + 2];
1653
- var actionIndex = indexOf(otherActions, target, method);
1654
-
1655
- if (actionIndex === -1) {
1656
- otherActions.push(target, method, flags);
1657
- newActions.push(target, method, flags);
1658
- }
1659
- }
1660
-
1661
- return newActions;
1662
- }
1663
-
1664
1603
  /**
1665
1604
  Add an event listener
1666
1605
 
@@ -1971,7 +1910,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1971
1910
  }
1972
1911
 
1973
1912
  if (propertyKey === 'content' && meta$$1.isProxy()) {
1974
- meta$$1.getTag().contentDidChange();
1913
+ objectTag.contentDidChange();
1975
1914
  }
1976
1915
 
1977
1916
  if (objectTag !== undefined || propertyTag !== undefined) {
@@ -1979,14 +1918,14 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1979
1918
  }
1980
1919
  }
1981
1920
 
1982
- var run = void 0;
1921
+ var backburner = void 0;
1983
1922
  function ensureRunloop() {
1984
- if (run === undefined) {
1985
- run = require('ember-metal').run;
1923
+ if (backburner === undefined) {
1924
+ backburner = require('ember-metal').run.backburner;
1986
1925
  }
1987
1926
 
1988
1927
  if (hasViews()) {
1989
- run.backburner.ensureInstance();
1928
+ backburner.ensureInstance();
1990
1929
  }
1991
1930
  }
1992
1931
 
@@ -2021,12 +1960,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2021
1960
  var observers = this.observers;
2022
1961
  var senderGuid = emberUtils.guidFor(sender);
2023
1962
  var keySet = observerSet[senderGuid];
2024
- var index = void 0;
2025
1963
 
2026
- if (!keySet) {
1964
+ if (keySet === undefined) {
2027
1965
  observerSet[senderGuid] = keySet = {};
2028
1966
  }
2029
- index = keySet[keyName];
1967
+
1968
+ var index = keySet[keyName];
2030
1969
  if (index === undefined) {
2031
1970
  index = observers.push({
2032
1971
  sender: sender,
@@ -2041,11 +1980,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2041
1980
 
2042
1981
  ObserverSet.prototype.flush = function flush() {
2043
1982
  var observers = this.observers;
2044
- var i = void 0,
2045
- observer = void 0,
1983
+ var observer = void 0,
2046
1984
  sender = void 0;
2047
1985
  this.clear();
2048
- for (i = 0; i < observers.length; ++i) {
1986
+ for (var i = 0; i < observers.length; ++i) {
2049
1987
  observer = observers[i];
2050
1988
  sender = observer.sender;
2051
1989
  if (sender.isDestroying || sender.isDestroyed) {
@@ -2180,7 +2118,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2180
2118
  */
2181
2119
  function propertyWillChange(obj, keyName, _meta) {
2182
2120
  var meta$$1 = _meta || exports.peekMeta(obj);
2183
-
2184
2121
  if (meta$$1 && !meta$$1.isInitialized(obj)) {
2185
2122
  return;
2186
2123
  }
@@ -2234,11 +2171,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2234
2171
  }
2235
2172
 
2236
2173
  if (hasMeta && meta$$1.peekWatching(keyName) > 0) {
2237
- if (meta$$1.hasDeps(keyName) && !meta$$1.isSourceDestroying()) {
2238
- dependentKeysDidChange(obj, keyName, meta$$1);
2239
- }
2240
-
2241
- chainsDidChange(obj, keyName, meta$$1, false);
2174
+ dependentKeysDidChange(obj, keyName, meta$$1);
2175
+ chainsDidChange(obj, keyName, meta$$1);
2242
2176
  notifyObservers(obj, keyName, meta$$1);
2243
2177
  }
2244
2178
 
@@ -2262,27 +2196,28 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2262
2196
  var DID_SEEN = void 0;
2263
2197
  // called whenever a property is about to change to clear the cache of any dependent keys (and notify those properties of changes, etc...)
2264
2198
  function dependentKeysWillChange(obj, depKey, meta$$1) {
2265
- if (meta$$1.isSourceDestroying()) {
2199
+ if (meta$$1.isSourceDestroying() || !meta$$1.hasDeps(depKey)) {
2266
2200
  return;
2267
2201
  }
2268
- if (meta$$1.hasDeps(depKey)) {
2269
- var seen = WILL_SEEN;
2270
- var top = !seen;
2202
+ var seen = WILL_SEEN;
2203
+ var top = !seen;
2271
2204
 
2272
- if (top) {
2273
- seen = WILL_SEEN = {};
2274
- }
2205
+ if (top) {
2206
+ seen = WILL_SEEN = {};
2207
+ }
2275
2208
 
2276
- iterDeps(propertyWillChange, obj, depKey, seen, meta$$1);
2209
+ iterDeps(propertyWillChange, obj, depKey, seen, meta$$1);
2277
2210
 
2278
- if (top) {
2279
- WILL_SEEN = null;
2280
- }
2211
+ if (top) {
2212
+ WILL_SEEN = null;
2281
2213
  }
2282
2214
  }
2283
2215
 
2284
2216
  // called whenever a property has just changed to update dependent keys
2285
2217
  function dependentKeysDidChange(obj, depKey, meta$$1) {
2218
+ if (meta$$1.isSourceDestroying() || !meta$$1.hasDeps(depKey)) {
2219
+ return;
2220
+ }
2286
2221
  var seen = DID_SEEN;
2287
2222
  var top = !seen;
2288
2223
 
@@ -2331,21 +2266,21 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2331
2266
 
2332
2267
  function chainsWillChange(obj, keyName, meta$$1) {
2333
2268
  var chainWatchers = meta$$1.readableChainWatchers();
2334
- if (chainWatchers) {
2269
+ if (chainWatchers !== undefined) {
2335
2270
  chainWatchers.notify(keyName, false, propertyWillChange);
2336
2271
  }
2337
2272
  }
2338
2273
 
2339
2274
  function chainsDidChange(obj, keyName, meta$$1) {
2340
2275
  var chainWatchers = meta$$1.readableChainWatchers();
2341
- if (chainWatchers) {
2276
+ if (chainWatchers !== undefined) {
2342
2277
  chainWatchers.notify(keyName, true, propertyDidChange);
2343
2278
  }
2344
2279
  }
2345
2280
 
2346
2281
  function overrideChains(obj, keyName, meta$$1) {
2347
2282
  var chainWatchers = meta$$1.readableChainWatchers();
2348
- if (chainWatchers) {
2283
+ if (chainWatchers !== undefined) {
2349
2284
  chainWatchers.revalidate(keyName);
2350
2285
  }
2351
2286
  }
@@ -2392,10 +2327,46 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2392
2327
  try {
2393
2328
  callback.call(binding);
2394
2329
  } finally {
2395
- endPropertyChanges.call(binding);
2330
+ endPropertyChanges();
2396
2331
  }
2397
2332
  }
2398
2333
 
2334
+ function indexOf(array, target, method) {
2335
+ var index = -1;
2336
+ // hashes are added to the end of the event array
2337
+ // so it makes sense to start searching at the end
2338
+ // of the array and search in reverse
2339
+ for (var i = array.length - 3; i >= 0; i -= 3) {
2340
+ if (target === array[i] && method === array[i + 1]) {
2341
+ index = i;
2342
+ break;
2343
+ }
2344
+ }
2345
+ return index;
2346
+ }
2347
+
2348
+ function accumulateListeners(obj, eventName, otherActions, meta$$1) {
2349
+ var actions = meta$$1.matchingListeners(eventName);
2350
+ if (actions === undefined) {
2351
+ return;
2352
+ }
2353
+ var newActions = [];
2354
+
2355
+ for (var i = actions.length - 3; i >= 0; i -= 3) {
2356
+ var target = actions[i];
2357
+ var method = actions[i + 1];
2358
+ var flags = actions[i + 2];
2359
+ var actionIndex = indexOf(otherActions, target, method);
2360
+
2361
+ if (actionIndex === -1) {
2362
+ otherActions.push(target, method, flags);
2363
+ newActions.push(target, method, flags);
2364
+ }
2365
+ }
2366
+
2367
+ return newActions;
2368
+ }
2369
+
2399
2370
  function notifyBeforeObservers(obj, keyName, meta$$1) {
2400
2371
  if (meta$$1.isSourceDestroying()) {
2401
2372
  return;
@@ -2404,13 +2375,11 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2404
2375
  var eventName = keyName + ':before';
2405
2376
  var listeners = void 0,
2406
2377
  added = void 0;
2407
- if (deferred) {
2378
+ if (deferred > 0) {
2408
2379
  listeners = beforeObserverSet.add(obj, keyName, eventName);
2409
- added = accumulateListeners(obj, eventName, listeners);
2410
- sendEvent(obj, eventName, [obj, keyName], added);
2411
- } else {
2412
- sendEvent(obj, eventName, [obj, keyName]);
2380
+ added = accumulateListeners(obj, eventName, listeners, meta$$1);
2413
2381
  }
2382
+ sendEvent(obj, eventName, [obj, keyName], added);
2414
2383
  }
2415
2384
 
2416
2385
  function notifyObservers(obj, keyName, meta$$1) {
@@ -2420,9 +2389,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2420
2389
 
2421
2390
  var eventName = keyName + ':change';
2422
2391
  var listeners = void 0;
2423
- if (deferred) {
2392
+ if (deferred > 0) {
2424
2393
  listeners = observerSet.add(obj, keyName, eventName);
2425
- accumulateListeners(obj, eventName, listeners);
2394
+ accumulateListeners(obj, eventName, listeners, meta$$1);
2426
2395
  } else {
2427
2396
  sendEvent(obj, eventName, [obj, keyName]);
2428
2397
  }
@@ -2484,14 +2453,19 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2484
2453
  function DEFAULT_GETTER_FUNCTION(name) {
2485
2454
  return function GETTER_FUNCTION() {
2486
2455
  var meta$$1 = exports.peekMeta(this);
2487
- return meta$$1 && meta$$1.peekValues(name);
2456
+ if (meta$$1 !== null && meta$$1 !== undefined) {
2457
+ return meta$$1.peekValues(name);
2458
+ }
2488
2459
  };
2489
2460
  }
2490
2461
 
2491
2462
  function INHERITING_GETTER_FUNCTION(name) {
2492
2463
  function IGETTER_FUNCTION() {
2493
2464
  var meta$$1 = exports.peekMeta(this);
2494
- var val = meta$$1 && meta$$1.readInheritedValue('values', name);
2465
+ var val = void 0;
2466
+ if (meta$$1 !== null && meta$$1 !== undefined) {
2467
+ val = meta$$1.readInheritedValue('values', name);
2468
+ }
2495
2469
 
2496
2470
  if (val === UNDEFINED) {
2497
2471
  var proto = Object.getPrototypeOf(this);
@@ -2551,7 +2525,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2551
2525
  become the explicit value of this property.
2552
2526
  */
2553
2527
  function defineProperty(obj, keyName, desc, data, meta$$1) {
2554
- if (!meta$$1) {
2528
+ if (meta$$1 === null || meta$$1 === undefined) {
2555
2529
  meta$$1 = meta(obj);
2556
2530
  }
2557
2531
 
@@ -2794,13 +2768,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2794
2768
  }
2795
2769
  }
2796
2770
 
2797
- // get the chains for the current object. If the current object has
2798
- // chains inherited from the proto they will be cloned and reconfigured for
2799
- // the current object.
2800
- function chainsFor(obj, meta$$1) {
2801
- return (meta$$1 || meta(obj)).writableChains(makeChainNode);
2802
- }
2803
-
2804
2771
  function makeChainNode(obj) {
2805
2772
  return new ChainNode(null, null, obj);
2806
2773
  }
@@ -2815,7 +2782,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2815
2782
  m.writeWatching(keyPath, counter + 1);
2816
2783
  if (counter === 0) {
2817
2784
  // activate watching first time
2818
- chainsFor(obj, m).add(keyPath);
2785
+ m.writableChains(makeChainNode).add(keyPath);
2819
2786
  }
2820
2787
  }
2821
2788
 
@@ -2831,7 +2798,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2831
2798
 
2832
2799
  if (counter === 1) {
2833
2800
  m.writeWatching(keyPath, 0);
2834
- chainsFor(obj, m).remove(keyPath);
2801
+ m.readableChains().remove(keyPath);
2835
2802
  } else if (counter > 1) {
2836
2803
  m.writeWatching(keyPath, counter - 1);
2837
2804
  }
@@ -3030,14 +2997,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3030
2997
  ChainNode.prototype.copy = function copy(obj) {
3031
2998
  var ret = new ChainNode(null, null, obj);
3032
2999
  var paths = this._paths;
3033
- var path = void 0;
3034
3000
  if (paths !== undefined) {
3001
+ var path = void 0;
3035
3002
  for (path in paths) {
3036
- // this check will also catch non-number vals.
3037
- if (paths[path] <= 0) {
3038
- continue;
3003
+ if (paths[path] > 0) {
3004
+ ret.add(path);
3039
3005
  }
3040
- ret.add(path);
3041
3006
  }
3042
3007
  }
3043
3008
  return ret;
@@ -3137,8 +3102,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3137
3102
 
3138
3103
  // then notify chains...
3139
3104
  var chains = this._chains;
3140
- var node = void 0;
3141
3105
  if (chains !== undefined) {
3106
+ var node = void 0;
3142
3107
  for (var key in chains) {
3143
3108
  node = chains[key];
3144
3109
  if (node !== undefined) {
@@ -3159,10 +3124,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3159
3124
 
3160
3125
  if (this._parent) {
3161
3126
  this._parent.populateAffected(path, depth + 1, affected);
3162
- } else {
3163
- if (depth > 1) {
3164
- affected.push(this.value(), path);
3165
- }
3127
+ } else if (depth > 1) {
3128
+ affected.push(this.value(), path);
3166
3129
  }
3167
3130
  };
3168
3131
 
@@ -3289,14 +3252,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3289
3252
  return this.proto !== obj;
3290
3253
  };
3291
3254
 
3292
- Meta.prototype.setTag = function setTag(tag) {
3293
- this._tag = tag;
3294
- };
3295
-
3296
- Meta.prototype.getTag = function getTag(tag) {
3297
- return this._tag;
3298
- };
3299
-
3300
3255
  Meta.prototype.destroy = function destroy() {
3301
3256
  if (this.isMetaDestroyed()) {
3302
3257
  return;
@@ -3307,14 +3262,14 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3307
3262
  key = void 0,
3308
3263
  nodeObject = void 0;
3309
3264
  var node = this.readableChains();
3310
- if (node) {
3265
+ if (node !== undefined) {
3311
3266
  NODE_STACK.push(node);
3312
3267
  // process tree
3313
3268
  while (NODE_STACK.length > 0) {
3314
3269
  node = NODE_STACK.pop();
3315
3270
  // push children
3316
3271
  nodes = node._chains;
3317
- if (nodes) {
3272
+ if (nodes !== undefined) {
3318
3273
  for (key in nodes) {
3319
3274
  if (nodes[key] !== undefined) {
3320
3275
  NODE_STACK.push(nodes[key]);
@@ -3325,7 +3280,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3325
3280
  // remove chainWatcher in node object
3326
3281
  if (node._watching) {
3327
3282
  nodeObject = node._object;
3328
- if (nodeObject) {
3283
+ if (nodeObject !== undefined) {
3329
3284
  var foreignMeta = exports.peekMeta(nodeObject);
3330
3285
  // avoid cleaning up chain watchers when both current and
3331
3286
  // foreign objects are being destroyed
@@ -3538,11 +3493,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3538
3493
 
3539
3494
  var ret = this._chains;
3540
3495
  if (ret === undefined) {
3541
- if (this.parent) {
3542
- ret = this._chains = this.parent.writableChains(create).copy(this.source);
3496
+ if (this.parent === undefined) {
3497
+ ret = create(this.source);
3543
3498
  } else {
3544
- ret = this._chains = create(this.source);
3499
+ ret = this.parent.writableChains(create).copy(this.source);
3545
3500
  }
3501
+ this._chains = ret;
3546
3502
  }
3547
3503
  return ret;
3548
3504
  };
@@ -3552,7 +3508,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3552
3508
  };
3553
3509
 
3554
3510
  Meta.prototype.writeWatching = function writeWatching(subkey, value) {
3555
- true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot update watchers for `hello` on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
3511
+ true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot update watchers for `' + subkey + '` on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
3556
3512
 
3557
3513
  var map = this._getOrCreateOwnMap('_watching');
3558
3514
  map[subkey] = value;
@@ -3755,7 +3711,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3755
3711
 
3756
3712
  pointer = getPrototypeOf(pointer);
3757
3713
  {
3758
- counters.peakPrototypeWalks++;
3714
+ counters.peekPrototypeWalks++;
3759
3715
  }
3760
3716
  }
3761
3717
  };
@@ -3905,47 +3861,29 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3905
3861
  return DefaultStore;
3906
3862
  }();
3907
3863
 
3908
- var IS_GLOBAL = /^[A-Z$]/;
3909
3864
  var IS_GLOBAL_PATH = /^[A-Z$].*[\.]/;
3910
- var HAS_THIS = 'this.';
3911
3865
 
3912
- var isGlobalCache = new Cache(1000, function (key) {
3913
- return IS_GLOBAL.test(key);
3914
- });
3915
3866
  var isGlobalPathCache = new Cache(1000, function (key) {
3916
3867
  return IS_GLOBAL_PATH.test(key);
3917
3868
  });
3918
- var hasThisCache = new Cache(1000, function (key) {
3919
- return key.lastIndexOf(HAS_THIS, 0) === 0;
3920
- });
3921
3869
  var firstDotIndexCache = new Cache(1000, function (key) {
3922
3870
  return key.indexOf('.');
3923
3871
  });
3924
3872
 
3925
3873
  var firstKeyCache = new Cache(1000, function (path) {
3926
3874
  var index = firstDotIndexCache.get(path);
3927
- if (index === -1) {
3928
- return path;
3929
- } else {
3930
- return path.slice(0, index);
3931
- }
3875
+ return index === -1 ? path : path.slice(0, index);
3932
3876
  });
3933
3877
 
3934
3878
  var tailPathCache = new Cache(1000, function (path) {
3935
3879
  var index = firstDotIndexCache.get(path);
3936
- if (index !== -1) {
3937
- return path.slice(index + 1);
3938
- }
3880
+ return index === -1 ? undefined : path.slice(index + 1);
3939
3881
  });
3940
3882
 
3941
3883
  function isGlobalPath(path) {
3942
3884
  return isGlobalPathCache.get(path);
3943
3885
  }
3944
3886
 
3945
- function hasThis(path) {
3946
- return hasThisCache.get(path);
3947
- }
3948
-
3949
3887
  function isPath(path) {
3950
3888
  return firstDotIndexCache.get(path) !== -1;
3951
3889
  }
@@ -4008,7 +3946,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4008
3946
  true && !(arguments.length === 2) && emberDebug.assert('Get must be called with two arguments; an object and a property key', arguments.length === 2);
4009
3947
  true && !(obj !== undefined && obj !== null) && emberDebug.assert('Cannot call get with \'' + keyName + '\' on an undefined object.', obj !== undefined && obj !== null);
4010
3948
  true && !(typeof keyName === 'string') && emberDebug.assert('The key provided to get must be a string, you passed ' + keyName, typeof keyName === 'string');
4011
- true && !!hasThis(keyName) && emberDebug.assert('\'this\' in paths is not supported', !hasThis(keyName));
3949
+ true && !(keyName.lastIndexOf('this.', 0) !== 0) && emberDebug.assert('\'this\' in paths is not supported', keyName.lastIndexOf('this.', 0) !== 0);
4012
3950
  true && !(keyName !== '') && emberDebug.assert('Cannot call `Ember.get` with an empty string', keyName !== '');
4013
3951
 
4014
3952
  var value = obj[keyName];
@@ -4018,7 +3956,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4018
3956
  return value.get(obj, keyName);
4019
3957
  } else if (isPath(keyName)) {
4020
3958
  return _getPath(obj, keyName);
4021
- } else if (value === undefined && 'object' === typeof obj && !(keyName in obj) && 'function' === typeof obj.unknownProperty) {
3959
+ } else if (value === undefined && 'object' === typeof obj && !(keyName in obj) && typeof obj.unknownProperty === 'function') {
4022
3960
  return obj.unknownProperty(keyName);
4023
3961
  } else {
4024
3962
  return value;
@@ -4095,7 +4033,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4095
4033
  true && !(arguments.length === 3 || arguments.length === 4) && emberDebug.assert('Set must be called with three or four arguments; an object, a property key, a value and tolerant true/false', arguments.length === 3 || arguments.length === 4);
4096
4034
  true && !(obj && typeof obj === 'object' || typeof obj === 'function') && emberDebug.assert('Cannot call set with \'' + keyName + '\' on an undefined object.', obj && typeof obj === 'object' || typeof obj === 'function');
4097
4035
  true && !(typeof keyName === 'string') && emberDebug.assert('The key provided to set must be a string, you passed ' + keyName, typeof keyName === 'string');
4098
- true && !!hasThis(keyName) && emberDebug.assert('\'this\' in paths is not supported', !hasThis(keyName));
4036
+ true && !(keyName.lastIndexOf('this.', 0) !== 0) && emberDebug.assert('\'this\' in paths is not supported', keyName.lastIndexOf('this.', 0) !== 0);
4099
4037
  true && !!obj.isDestroyed && emberDebug.assert('calling set on destroyed object: ' + emberUtils.toString(obj) + '.' + keyName + ' = ' + emberUtils.toString(value), !obj.isDestroyed);
4100
4038
 
4101
4039
  if (isPath(keyName)) {
@@ -4108,10 +4046,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4108
4046
  if (isDescriptor) {
4109
4047
  /* computed property */
4110
4048
  currentValue.set(obj, keyName, value);
4111
- } else if (obj.setUnknownProperty && currentValue === undefined && !(keyName in obj)) {
4049
+ } else if (currentValue === undefined && 'object' === typeof obj && !(keyName in obj) && typeof obj.setUnknownProperty === 'function') {
4112
4050
  /* unknown property */
4113
- true && !(typeof obj.setUnknownProperty === 'function') && emberDebug.assert('setUnknownProperty must be a function', typeof obj.setUnknownProperty === 'function');
4114
-
4115
4051
  obj.setUnknownProperty(keyName, value);
4116
4052
  } else if (currentValue === value) {/* no change */
4117
4053
  } else {
@@ -4151,31 +4087,20 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4151
4087
  }
4152
4088
 
4153
4089
  function setPath(root, path, value, tolerant) {
4154
- // get the last part of the path
4155
- var keyName = path.slice(path.lastIndexOf('.') + 1);
4090
+ var parts = path.split('.');
4091
+ var keyName = parts.pop();
4156
4092
 
4157
- // get the first part of the part
4158
- path = path === keyName ? keyName : path.slice(0, path.length - (keyName.length + 1));
4093
+ true && !(keyName.trim().length > 0) && emberDebug.assert('Property set failed: You passed an empty path', keyName.trim().length > 0);
4159
4094
 
4160
- // unless the path is this, look up the first part to
4161
- // get the root
4162
- if (path !== 'this') {
4163
- root = _getPath(root, path);
4164
- }
4095
+ var newPath = parts.join('.');
4165
4096
 
4166
- if (!keyName || keyName.length === 0) {
4167
- throw new emberDebug.Error('Property set failed: You passed an empty path');
4168
- }
4097
+ var newRoot = _getPath(root, newPath);
4169
4098
 
4170
- if (!root) {
4171
- if (tolerant) {
4172
- return;
4173
- } else {
4174
- throw new emberDebug.Error('Property set failed: object in path "' + path + '" could not be found or was destroyed.');
4175
- }
4099
+ if (newRoot) {
4100
+ return set(newRoot, keyName, value);
4101
+ } else if (!tolerant) {
4102
+ throw new emberDebug.Error('Property set failed: object in path "' + newPath + '" could not be found or was destroyed.');
4176
4103
  }
4177
-
4178
- return set(root, keyName, value);
4179
4104
  }
4180
4105
 
4181
4106
  /**
@@ -4225,7 +4150,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4225
4150
 
4226
4151
  @method expandProperties
4227
4152
  @for Ember
4228
- @private
4153
+ @public
4229
4154
  @param {String} pattern The property pattern to expand.
4230
4155
  @param {Function} callback The callback to invoke. It is invoked once per
4231
4156
  expansion, and is passed the expansion.
@@ -4268,7 +4193,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4268
4193
  /**
4269
4194
  @module ember-metal
4270
4195
  */
4271
-
4272
4196
  /**
4273
4197
  Starts watching a property on an object. Whenever the property changes,
4274
4198
  invokes `Ember.propertyWillChange` and `Ember.propertyDidChange`. This is the
@@ -4283,19 +4207,15 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4283
4207
  @param {String} _keyPath
4284
4208
  */
4285
4209
  function watch(obj, _keyPath, m) {
4286
- if (!isPath(_keyPath)) {
4287
- watchKey(obj, _keyPath, m);
4288
- } else {
4210
+ if (isPath(_keyPath)) {
4289
4211
  watchPath(obj, _keyPath, m);
4212
+ } else {
4213
+ watchKey(obj, _keyPath, m);
4290
4214
  }
4291
4215
  }
4292
4216
 
4293
4217
  function isWatching(obj, key) {
4294
- if (typeof obj !== 'object' || obj === null) {
4295
- return false;
4296
- }
4297
- var meta$$1 = exports.peekMeta(obj);
4298
- return (meta$$1 && meta$$1.peekWatching(key)) > 0;
4218
+ return watcherCount(obj, key) > 0;
4299
4219
  }
4300
4220
 
4301
4221
  function watcherCount(obj, key) {
@@ -4304,27 +4224,13 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4304
4224
  }
4305
4225
 
4306
4226
  function unwatch(obj, _keyPath, m) {
4307
- if (!isPath(_keyPath)) {
4308
- unwatchKey(obj, _keyPath, m);
4309
- } else {
4227
+ if (isPath(_keyPath)) {
4310
4228
  unwatchPath(obj, _keyPath, m);
4229
+ } else {
4230
+ unwatchKey(obj, _keyPath, m);
4311
4231
  }
4312
4232
  }
4313
4233
 
4314
- /**
4315
- Tears down the meta on an object so that it can be garbage collected.
4316
- Multiple calls will have no effect.
4317
-
4318
- @method destroy
4319
- @for Ember
4320
- @param {Object} obj the object to destroy
4321
- @return {void}
4322
- @private
4323
- */
4324
- function destroy(obj) {
4325
- deleteMeta(obj);
4326
- }
4327
-
4328
4234
  /**
4329
4235
  @module ember
4330
4236
  @submodule ember-metal
@@ -4337,15 +4243,13 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4337
4243
  function addDependentKeys(desc, obj, keyName, meta) {
4338
4244
  // the descriptor has a list of dependent keys, so
4339
4245
  // add all of its dependent keys.
4340
- var idx = void 0,
4341
- depKey = void 0;
4342
4246
  var depKeys = desc._dependentKeys;
4343
- if (!depKeys) {
4247
+ if (depKeys === null || depKeys === undefined) {
4344
4248
  return;
4345
4249
  }
4346
4250
 
4347
- for (idx = 0; idx < depKeys.length; idx++) {
4348
- depKey = depKeys[idx];
4251
+ for (var idx = 0; idx < depKeys.length; idx++) {
4252
+ var depKey = depKeys[idx];
4349
4253
  // Increment the number of times depKey depends on keyName.
4350
4254
  meta.writeDeps(depKey, keyName, (meta.peekDeps(depKey, keyName) || 0) + 1);
4351
4255
  // Watch the depKey
@@ -4357,7 +4261,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4357
4261
  // the descriptor has a list of dependent keys, so
4358
4262
  // remove all of its dependent keys.
4359
4263
  var depKeys = desc._dependentKeys;
4360
- if (!depKeys) {
4264
+ if (depKeys === null || depKeys === undefined) {
4361
4265
  return;
4362
4266
  }
4363
4267
 
@@ -5361,12 +5265,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5361
5265
  };
5362
5266
 
5363
5267
  var onerror = void 0;
5364
- var onErrorTarget = {
5365
- get onerror() {
5366
- return dispatchOverride || onerror;
5367
- }
5368
- };
5369
-
5370
5268
  // Ember.onerror getter
5371
5269
  function getOnerror() {
5372
5270
  return onerror;
@@ -5425,113 +5323,122 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5425
5323
  * practice, most use cases satisfy this limitation which is why it is included
5426
5324
  * in ember-metal.
5427
5325
  */
5428
- function WeakMap$1(iterable) {
5429
- if (!(this instanceof WeakMap$1)) {
5430
- throw new TypeError('Constructor WeakMap requires \'new\'');
5431
- }
5326
+ var WeakMapPolyfill = function () {
5327
+ function WeakMapPolyfill(iterable) {
5328
+ emberBabel.classCallCheck(this, WeakMapPolyfill);
5432
5329
 
5433
- this._id = emberUtils.GUID_KEY + id++;
5330
+ this._id = emberUtils.GUID_KEY + id++;
5434
5331
 
5435
- if (iterable === null || iterable === undefined) {
5436
- return;
5437
- } else if (Array.isArray(iterable)) {
5438
- for (var i = 0; i < iterable.length; i++) {
5439
- var _iterable$i = iterable[i],
5440
- key = _iterable$i[0],
5441
- value = _iterable$i[1];
5332
+ if (iterable === null || iterable === undefined) {
5333
+ return;
5334
+ } else if (Array.isArray(iterable)) {
5335
+ for (var i = 0; i < iterable.length; i++) {
5336
+ var _iterable$i = iterable[i],
5337
+ key = _iterable$i[0],
5338
+ value = _iterable$i[1];
5442
5339
 
5443
- this.set(key, value);
5340
+ this.set(key, value);
5341
+ }
5342
+ } else {
5343
+ throw new TypeError('The weak map constructor polyfill only supports an array argument');
5444
5344
  }
5445
- } else {
5446
- throw new TypeError('The weak map constructor polyfill only supports an array argument');
5447
5345
  }
5448
- }
5449
5346
 
5450
- /*
5451
- * @method get
5452
- * @param key {Object | Function}
5453
- * @return {Any} stored value
5454
- */
5455
- WeakMap$1.prototype.get = function (obj) {
5456
- if (!isObject$1(obj)) {
5457
- return undefined;
5458
- }
5347
+ /*
5348
+ * @method get
5349
+ * @param key {Object | Function}
5350
+ * @return {Any} stored value
5351
+ */
5459
5352
 
5460
- var meta$$1 = exports.peekMeta(obj);
5461
- if (meta$$1) {
5462
- var map = meta$$1.readableWeak();
5463
- if (map) {
5464
- if (map[this._id] === UNDEFINED) {
5465
- return undefined;
5353
+ WeakMapPolyfill.prototype.get = function get(obj) {
5354
+ if (!isObject$1(obj)) {
5355
+ return undefined;
5356
+ }
5357
+
5358
+ var meta$$1 = exports.peekMeta(obj);
5359
+ if (meta$$1) {
5360
+ var map = meta$$1.readableWeak();
5361
+ if (map !== undefined) {
5362
+ var val = map[this._id];
5363
+ if (val === UNDEFINED) {
5364
+ return undefined;
5365
+ }
5366
+ return val;
5466
5367
  }
5368
+ }
5369
+ };
5370
+
5371
+ /*
5372
+ * @method set
5373
+ * @param key {Object | Function}
5374
+ * @param value {Any}
5375
+ * @return {WeakMap} the weak map
5376
+ */
5467
5377
 
5468
- return map[this._id];
5378
+ WeakMapPolyfill.prototype.set = function set(obj, value) {
5379
+ if (!isObject$1(obj)) {
5380
+ throw new TypeError('Invalid value used as weak map key');
5469
5381
  }
5470
- }
5471
- };
5472
5382
 
5473
- /*
5474
- * @method set
5475
- * @param key {Object | Function}
5476
- * @param value {Any}
5477
- * @return {WeakMap} the weak map
5478
- */
5479
- WeakMap$1.prototype.set = function (obj, value) {
5480
- if (!isObject$1(obj)) {
5481
- throw new TypeError('Invalid value used as weak map key');
5482
- }
5383
+ if (value === undefined) {
5384
+ value = UNDEFINED;
5385
+ }
5483
5386
 
5484
- if (value === undefined) {
5485
- value = UNDEFINED;
5486
- }
5387
+ meta(obj).writableWeak()[this._id] = value;
5487
5388
 
5488
- meta(obj).writableWeak()[this._id] = value;
5389
+ return this;
5390
+ };
5489
5391
 
5490
- return this;
5491
- };
5392
+ /*
5393
+ * @method has
5394
+ * @param key {Object | Function}
5395
+ * @return {boolean} if the key exists
5396
+ */
5397
+
5398
+ WeakMapPolyfill.prototype.has = function has(obj) {
5399
+ if (!isObject$1(obj)) {
5400
+ return false;
5401
+ }
5402
+
5403
+ var meta$$1 = exports.peekMeta(obj);
5404
+ if (meta$$1) {
5405
+ var map = meta$$1.readableWeak();
5406
+ if (map !== undefined) {
5407
+ return map[this._id] !== undefined;
5408
+ }
5409
+ }
5492
5410
 
5493
- /*
5494
- * @method has
5495
- * @param key {Object | Function}
5496
- * @return {boolean} if the key exists
5497
- */
5498
- WeakMap$1.prototype.has = function (obj) {
5499
- if (!isObject$1(obj)) {
5500
5411
  return false;
5501
- }
5412
+ };
5502
5413
 
5503
- var meta$$1 = exports.peekMeta(obj);
5504
- if (meta$$1) {
5505
- var map = meta$$1.readableWeak();
5506
- if (map) {
5507
- return map[this._id] !== undefined;
5414
+ /*
5415
+ * @method delete
5416
+ * @param key {Object | Function}
5417
+ * @return {boolean} if the key was deleted
5418
+ */
5419
+
5420
+ WeakMapPolyfill.prototype.delete = function _delete(obj) {
5421
+ if (this.has(obj)) {
5422
+ delete exports.peekMeta(obj).writableWeak()[this._id];
5423
+ return true;
5424
+ } else {
5425
+ return false;
5508
5426
  }
5509
- }
5427
+ };
5510
5428
 
5511
- return false;
5512
- };
5429
+ /*
5430
+ * @method toString
5431
+ * @return {String}
5432
+ */
5513
5433
 
5514
- /*
5515
- * @method delete
5516
- * @param key {Object | Function}
5517
- * @return {boolean} if the key was deleted
5518
- */
5519
- WeakMap$1.prototype.delete = function (obj) {
5520
- if (this.has(obj)) {
5521
- delete meta(obj).writableWeak()[this._id];
5522
- return true;
5523
- } else {
5524
- return false;
5525
- }
5526
- };
5434
+ WeakMapPolyfill.prototype.toString = function toString$$1() {
5435
+ return '[object WeakMap]';
5436
+ };
5527
5437
 
5528
- /*
5529
- * @method toString
5530
- * @return {String}
5531
- */
5532
- WeakMap$1.prototype.toString = function () {
5533
- return '[object WeakMap]';
5534
- };
5438
+ return WeakMapPolyfill;
5439
+ }();
5440
+
5441
+ var weak_map = emberUtils.HAS_NATIVE_WEAKMAP ? WeakMap : WeakMapPolyfill;
5535
5442
 
5536
5443
  /**
5537
5444
  Returns true if the passed value is null or undefined. This avoids errors
@@ -5679,14 +5586,23 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5679
5586
  }
5680
5587
 
5681
5588
  function onBegin(current) {
5682
- run$1.currentRunLoop = current;
5589
+ run.currentRunLoop = current;
5683
5590
  }
5684
5591
 
5685
5592
  function onEnd(current, next) {
5686
- run$1.currentRunLoop = next;
5593
+ run.currentRunLoop = next;
5687
5594
  }
5688
5595
 
5689
- var backburner = new Backburner(['sync', 'actions', 'destroy'], {
5596
+ var onErrorTarget = {
5597
+ get onerror() {
5598
+ return dispatchError;
5599
+ },
5600
+ set onerror(handler) {
5601
+ return setOnerror(handler);
5602
+ }
5603
+ };
5604
+
5605
+ var backburner$1 = new Backburner(['sync', 'actions', 'destroy'], {
5690
5606
  GUID_KEY: emberUtils.GUID_KEY,
5691
5607
  sync: {
5692
5608
  before: beginPropertyChanges,
@@ -5731,8 +5647,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5731
5647
  @return {Object} return value from invoking the passed function.
5732
5648
  @public
5733
5649
  */
5734
- function run$1() {
5735
- return backburner.run.apply(backburner, arguments);
5650
+ function run() {
5651
+ return backburner$1.run.apply(backburner$1, arguments);
5736
5652
  }
5737
5653
 
5738
5654
  /**
@@ -5773,8 +5689,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5773
5689
  when called within an existing loop, no return value is possible.
5774
5690
  @public
5775
5691
  */
5776
- run$1.join = function () {
5777
- return backburner.join.apply(backburner, arguments);
5692
+ run.join = function () {
5693
+ return backburner$1.join.apply(backburner$1, arguments);
5778
5694
  };
5779
5695
 
5780
5696
  /**
@@ -5827,7 +5743,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5827
5743
  @since 1.4.0
5828
5744
  @public
5829
5745
  */
5830
- run$1.bind = function () {
5746
+ run.bind = function () {
5831
5747
  for (var _len = arguments.length, curried = Array(_len), _key = 0; _key < _len; _key++) {
5832
5748
  curried[_key] = arguments[_key];
5833
5749
  }
@@ -5837,13 +5753,13 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5837
5753
  args[_key2] = arguments[_key2];
5838
5754
  }
5839
5755
 
5840
- return run$1.join.apply(run$1, curried.concat(args));
5756
+ return run.join.apply(run, curried.concat(args));
5841
5757
  };
5842
5758
  };
5843
5759
 
5844
- run$1.backburner = backburner;
5845
- run$1.currentRunLoop = null;
5846
- run$1.queues = backburner.queueNames;
5760
+ run.backburner = backburner$1;
5761
+ run.currentRunLoop = null;
5762
+ run.queues = backburner$1.queueNames;
5847
5763
 
5848
5764
  /**
5849
5765
  Begins a new RunLoop. Any deferred actions invoked after the begin will
@@ -5860,8 +5776,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5860
5776
  @return {void}
5861
5777
  @public
5862
5778
  */
5863
- run$1.begin = function () {
5864
- backburner.begin();
5779
+ run.begin = function () {
5780
+ backburner$1.begin();
5865
5781
  };
5866
5782
 
5867
5783
  /**
@@ -5879,8 +5795,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5879
5795
  @return {void}
5880
5796
  @public
5881
5797
  */
5882
- run$1.end = function () {
5883
- backburner.end();
5798
+ run.end = function () {
5799
+ backburner$1.end();
5884
5800
  };
5885
5801
 
5886
5802
  /**
@@ -5933,20 +5849,20 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5933
5849
  @return {*} Timer information for use in canceling, see `run.cancel`.
5934
5850
  @public
5935
5851
  */
5936
- run$1.schedule = function () /* queue, target, method */{
5937
- true && !(run$1.currentRunLoop || !emberDebug.isTesting()) && emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run$1.currentRunLoop || !emberDebug.isTesting());
5852
+ run.schedule = function () /* queue, target, method */{
5853
+ true && !(run.currentRunLoop || !emberDebug.isTesting()) && emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run.currentRunLoop || !emberDebug.isTesting());
5938
5854
 
5939
- return backburner.schedule.apply(backburner, arguments);
5855
+ return backburner$1.schedule.apply(backburner$1, arguments);
5940
5856
  };
5941
5857
 
5942
5858
  // Used by global test teardown
5943
- run$1.hasScheduledTimers = function () {
5944
- return backburner.hasTimers();
5859
+ run.hasScheduledTimers = function () {
5860
+ return backburner$1.hasTimers();
5945
5861
  };
5946
5862
 
5947
5863
  // Used by global test teardown
5948
- run$1.cancelTimers = function () {
5949
- backburner.cancelTimers();
5864
+ run.cancelTimers = function () {
5865
+ backburner$1.cancelTimers();
5950
5866
  };
5951
5867
 
5952
5868
  /**
@@ -5966,9 +5882,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5966
5882
  @return {void}
5967
5883
  @private
5968
5884
  */
5969
- run$1.sync = function () {
5970
- if (backburner.currentInstance) {
5971
- backburner.currentInstance.queues.sync.flush();
5885
+ run.sync = function () {
5886
+ if (backburner$1.currentInstance) {
5887
+ backburner$1.currentInstance.queues.sync.flush();
5972
5888
  }
5973
5889
  };
5974
5890
 
@@ -5998,8 +5914,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5998
5914
  @return {*} Timer information for use in canceling, see `run.cancel`.
5999
5915
  @public
6000
5916
  */
6001
- run$1.later = function () /*target, method*/{
6002
- return backburner.later.apply(backburner, arguments);
5917
+ run.later = function () /*target, method*/{
5918
+ return backburner$1.later.apply(backburner$1, arguments);
6003
5919
  };
6004
5920
 
6005
5921
  /**
@@ -6015,15 +5931,15 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6015
5931
  @return {Object} Timer information for use in canceling, see `run.cancel`.
6016
5932
  @public
6017
5933
  */
6018
- run$1.once = function () {
6019
- true && !(run$1.currentRunLoop || !emberDebug.isTesting()) && emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run$1.currentRunLoop || !emberDebug.isTesting());
5934
+ run.once = function () {
5935
+ true && !(run.currentRunLoop || !emberDebug.isTesting()) && emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run.currentRunLoop || !emberDebug.isTesting());
6020
5936
 
6021
5937
  for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
6022
5938
  args[_key3] = arguments[_key3];
6023
5939
  }
6024
5940
 
6025
5941
  args.unshift('actions');
6026
- return backburner.scheduleOnce.apply(backburner, args);
5942
+ return backburner$1.scheduleOnce.apply(backburner$1, args);
6027
5943
  };
6028
5944
 
6029
5945
  /**
@@ -6078,10 +5994,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6078
5994
  @return {Object} Timer information for use in canceling, see `run.cancel`.
6079
5995
  @public
6080
5996
  */
6081
- run$1.scheduleOnce = function () /*queue, target, method*/{
6082
- true && !(run$1.currentRunLoop || !emberDebug.isTesting()) && emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run$1.currentRunLoop || !emberDebug.isTesting());
5997
+ run.scheduleOnce = function () /*queue, target, method*/{
5998
+ true && !(run.currentRunLoop || !emberDebug.isTesting()) && emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run.currentRunLoop || !emberDebug.isTesting());
6083
5999
 
6084
- return backburner.scheduleOnce.apply(backburner, arguments);
6000
+ return backburner$1.scheduleOnce.apply(backburner$1, arguments);
6085
6001
  };
6086
6002
 
6087
6003
  /**
@@ -6147,13 +6063,13 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6147
6063
  @return {Object} Timer information for use in canceling, see `run.cancel`.
6148
6064
  @public
6149
6065
  */
6150
- run$1.next = function () {
6066
+ run.next = function () {
6151
6067
  for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
6152
6068
  args[_key4] = arguments[_key4];
6153
6069
  }
6154
6070
 
6155
6071
  args.push(1);
6156
- return backburner.later.apply(backburner, args);
6072
+ return backburner$1.later.apply(backburner$1, args);
6157
6073
  };
6158
6074
 
6159
6075
  /**
@@ -6211,8 +6127,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6211
6127
  @return {Boolean} true if canceled or false/undefined if it wasn't found
6212
6128
  @public
6213
6129
  */
6214
- run$1.cancel = function (timer) {
6215
- return backburner.cancel(timer);
6130
+ run.cancel = function (timer) {
6131
+ return backburner$1.cancel(timer);
6216
6132
  };
6217
6133
 
6218
6134
  /**
@@ -6284,8 +6200,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6284
6200
  @return {Array} Timer information for use in canceling, see `run.cancel`.
6285
6201
  @public
6286
6202
  */
6287
- run$1.debounce = function () {
6288
- return backburner.debounce.apply(backburner, arguments);
6203
+ run.debounce = function () {
6204
+ return backburner$1.debounce.apply(backburner$1, arguments);
6289
6205
  };
6290
6206
 
6291
6207
  /**
@@ -6327,8 +6243,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6327
6243
  @return {Array} Timer information for use in canceling, see `run.cancel`.
6328
6244
  @public
6329
6245
  */
6330
- run$1.throttle = function () {
6331
- return backburner.throttle.apply(backburner, arguments);
6246
+ run.throttle = function () {
6247
+ return backburner$1.throttle.apply(backburner$1, arguments);
6332
6248
  };
6333
6249
 
6334
6250
  /**
@@ -6341,9 +6257,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6341
6257
  @param {String} after the name of the queue to add after.
6342
6258
  @private
6343
6259
  */
6344
- run$1._addQueue = function (name, after) {
6345
- if (run$1.queues.indexOf(name) === -1) {
6346
- run$1.queues.splice(run$1.queues.indexOf(after) + 1, 0, name);
6260
+ run._addQueue = function (name, after) {
6261
+ if (run.queues.indexOf(name) === -1) {
6262
+ run.queues.splice(run.queues.indexOf(after) + 1, 0, name);
6347
6263
  }
6348
6264
  };
6349
6265
 
@@ -7293,7 +7209,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
7293
7209
 
7294
7210
  // If we haven't scheduled the binding yet, schedule it.
7295
7211
  if (existingDir === undefined) {
7296
- run$1.schedule('sync', this, '_sync');
7212
+ run.schedule('sync', this, '_sync');
7297
7213
  this._direction = dir;
7298
7214
  }
7299
7215
 
@@ -8587,8 +8503,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
8587
8503
  exports.getWithDefault = getWithDefault;
8588
8504
  exports.set = set;
8589
8505
  exports.trySet = trySet;
8590
- exports.WeakMap = WeakMap$1;
8591
- exports.accumulateListeners = accumulateListeners;
8506
+ exports.WeakMap = weak_map;
8507
+ exports.WeakMapPolyfill = WeakMapPolyfill;
8592
8508
  exports.addListener = addListener;
8593
8509
  exports.hasListeners = hasListeners;
8594
8510
  exports.listenersFor = listenersFor;
@@ -8602,7 +8518,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
8602
8518
  exports.isEmpty = isEmpty;
8603
8519
  exports.isBlank = isBlank;
8604
8520
  exports.isPresent = isPresent;
8605
- exports.run = run$1;
8521
+ exports.run = run;
8606
8522
  exports.ObserverSet = ObserverSet;
8607
8523
  exports.beginPropertyChanges = beginPropertyChanges;
8608
8524
  exports.changeProperties = changeProperties;
@@ -8621,7 +8537,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
8621
8537
  exports.removeChainWatcher = removeChainWatcher;
8622
8538
  exports.watchPath = watchPath;
8623
8539
  exports.unwatchPath = unwatchPath;
8624
- exports.destroy = destroy;
8540
+ exports.destroy = deleteMeta;
8625
8541
  exports.isWatching = isWatching;
8626
8542
  exports.unwatch = unwatch;
8627
8543
  exports.watch = watch;
@@ -9164,106 +9080,100 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
9164
9080
  return child;
9165
9081
  }
9166
9082
 
9167
- var Enumerator = function () {
9168
- function Enumerator(Constructor, input, abortOnReject, label) {
9169
- (0, _emberBabel.classCallCheck)(this, Enumerator);
9170
-
9171
- this._instanceConstructor = Constructor;
9172
- this.promise = new Constructor(noop, label);
9173
- this._abortOnReject = abortOnReject;
9083
+ function Enumerator(Constructor, input, abortOnReject, label) {
9084
+ this._instanceConstructor = Constructor;
9085
+ this.promise = new Constructor(noop, label);
9086
+ this._abortOnReject = abortOnReject;
9174
9087
 
9175
- this._init.apply(this, arguments);
9176
- }
9088
+ this._init.apply(this, arguments);
9089
+ }
9177
9090
 
9178
- Enumerator.prototype._init = function _init(Constructor, input) {
9179
- var len = input.length || 0;
9180
- this.length = len;
9181
- this._remaining = len;
9182
- this._result = new Array(len);
9091
+ Enumerator.prototype._init = function (Constructor, input) {
9092
+ var len = input.length || 0;
9093
+ this.length = len;
9094
+ this._remaining = len;
9095
+ this._result = new Array(len);
9183
9096
 
9184
- this._enumerate(input);
9185
- if (this._remaining === 0) {
9186
- fulfill(this.promise, this._result);
9187
- }
9188
- };
9097
+ this._enumerate(input);
9098
+ if (this._remaining === 0) {
9099
+ fulfill(this.promise, this._result);
9100
+ }
9101
+ };
9189
9102
 
9190
- Enumerator.prototype._enumerate = function _enumerate(input) {
9191
- var length = this.length;
9192
- var promise = this.promise;
9103
+ Enumerator.prototype._enumerate = function (input) {
9104
+ var length = this.length;
9105
+ var promise = this.promise;
9193
9106
 
9194
- for (var i = 0; promise._state === PENDING && i < length; i++) {
9195
- this._eachEntry(input[i], i);
9196
- }
9197
- };
9107
+ for (var i = 0; promise._state === PENDING && i < length; i++) {
9108
+ this._eachEntry(input[i], i);
9109
+ }
9110
+ };
9198
9111
 
9199
- Enumerator.prototype._settleMaybeThenable = function _settleMaybeThenable(entry, i) {
9200
- var c = this._instanceConstructor;
9201
- var resolve$$1 = c.resolve;
9112
+ Enumerator.prototype._settleMaybeThenable = function (entry, i) {
9113
+ var c = this._instanceConstructor;
9114
+ var resolve$$1 = c.resolve;
9202
9115
 
9203
- if (resolve$$1 === resolve$1) {
9204
- var then$$1 = getThen(entry);
9116
+ if (resolve$$1 === resolve$1) {
9117
+ var then$$1 = getThen(entry);
9205
9118
 
9206
- if (then$$1 === then && entry._state !== PENDING) {
9207
- entry._onError = null;
9208
- this._settledAt(entry._state, i, entry._result);
9209
- } else if (typeof then$$1 !== 'function') {
9210
- this._remaining--;
9211
- this._result[i] = this._makeResult(FULFILLED, i, entry);
9212
- } else if (c === Promise) {
9213
- var promise = new c(noop);
9214
- handleMaybeThenable(promise, entry, then$$1);
9215
- this._willSettleAt(promise, i);
9216
- } else {
9217
- this._willSettleAt(new c(function (resolve$$1) {
9218
- return resolve$$1(entry);
9219
- }), i);
9220
- }
9221
- } else {
9222
- this._willSettleAt(resolve$$1(entry), i);
9223
- }
9224
- };
9225
-
9226
- Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
9227
- if (isMaybeThenable(entry)) {
9228
- this._settleMaybeThenable(entry, i);
9229
- } else {
9119
+ if (then$$1 === then && entry._state !== PENDING) {
9120
+ entry._onError = null;
9121
+ this._settledAt(entry._state, i, entry._result);
9122
+ } else if (typeof then$$1 !== 'function') {
9230
9123
  this._remaining--;
9231
9124
  this._result[i] = this._makeResult(FULFILLED, i, entry);
9125
+ } else if (c === Promise) {
9126
+ var promise = new c(noop);
9127
+ handleMaybeThenable(promise, entry, then$$1);
9128
+ this._willSettleAt(promise, i);
9129
+ } else {
9130
+ this._willSettleAt(new c(function (resolve$$1) {
9131
+ return resolve$$1(entry);
9132
+ }), i);
9232
9133
  }
9233
- };
9134
+ } else {
9135
+ this._willSettleAt(resolve$$1(entry), i);
9136
+ }
9137
+ };
9234
9138
 
9235
- Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
9236
- var promise = this.promise;
9139
+ Enumerator.prototype._eachEntry = function (entry, i) {
9140
+ if (isMaybeThenable(entry)) {
9141
+ this._settleMaybeThenable(entry, i);
9142
+ } else {
9143
+ this._remaining--;
9144
+ this._result[i] = this._makeResult(FULFILLED, i, entry);
9145
+ }
9146
+ };
9237
9147
 
9238
- if (promise._state === PENDING) {
9239
- if (this._abortOnReject && state === REJECTED) {
9240
- reject(promise, value);
9241
- } else {
9242
- this._remaining--;
9243
- this._result[i] = this._makeResult(state, i, value);
9244
- if (this._remaining === 0) {
9245
- fulfill(promise, this._result);
9246
- }
9148
+ Enumerator.prototype._settledAt = function (state, i, value) {
9149
+ var promise = this.promise;
9150
+
9151
+ if (promise._state === PENDING) {
9152
+ if (this._abortOnReject && state === REJECTED) {
9153
+ reject(promise, value);
9154
+ } else {
9155
+ this._remaining--;
9156
+ this._result[i] = this._makeResult(state, i, value);
9157
+ if (this._remaining === 0) {
9158
+ fulfill(promise, this._result);
9247
9159
  }
9248
9160
  }
9249
- };
9250
-
9251
- Enumerator.prototype._makeResult = function _makeResult(state, i, value) {
9252
- return value;
9253
- };
9161
+ }
9162
+ };
9254
9163
 
9255
- Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
9256
- var enumerator = this;
9164
+ Enumerator.prototype._makeResult = function (state, i, value) {
9165
+ return value;
9166
+ };
9257
9167
 
9258
- subscribe(promise, undefined, function (value) {
9259
- return enumerator._settledAt(FULFILLED, i, value);
9260
- }, function (reason) {
9261
- return enumerator._settledAt(REJECTED, i, reason);
9262
- });
9263
- };
9168
+ Enumerator.prototype._willSettleAt = function (promise, i) {
9169
+ var enumerator = this;
9264
9170
 
9265
- return Enumerator;
9266
- }();
9171
+ subscribe(promise, undefined, function (value) {
9172
+ return enumerator._settledAt(FULFILLED, i, value);
9173
+ }, function (reason) {
9174
+ return enumerator._settledAt(REJECTED, i, reason);
9175
+ });
9176
+ };
9267
9177
 
9268
9178
  function makeSettledResult(state, position, value) {
9269
9179
  if (state === FULFILLED) {
@@ -9579,56 +9489,117 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
9579
9489
  Useful for tooling.
9580
9490
  @constructor
9581
9491
  */
9492
+ function Promise(resolver, label) {
9493
+ this._id = counter++;
9494
+ this._label = label;
9495
+ this._state = undefined;
9496
+ this._result = undefined;
9497
+ this._subscribers = [];
9582
9498
 
9583
- var Promise = function () {
9584
- function Promise(resolver, label) {
9585
- (0, _emberBabel.classCallCheck)(this, Promise);
9499
+ config.instrument && instrument('created', this);
9586
9500
 
9587
- this._id = counter++;
9588
- this._label = label;
9589
- this._state = undefined;
9590
- this._result = undefined;
9591
- this._subscribers = [];
9501
+ if (noop !== resolver) {
9502
+ typeof resolver !== 'function' && needsResolver();
9503
+ this instanceof Promise ? initializePromise(this, resolver) : needsNew();
9504
+ }
9505
+ }
9592
9506
 
9593
- config.instrument && instrument('created', this);
9507
+ Promise.prototype._onError = function (reason) {
9508
+ var _this = this;
9594
9509
 
9595
- if (noop !== resolver) {
9596
- typeof resolver !== 'function' && needsResolver();
9597
- this instanceof Promise ? initializePromise(this, resolver) : needsNew();
9510
+ config.after(function () {
9511
+ if (_this._onError) {
9512
+ config.trigger('error', reason, _this._label);
9598
9513
  }
9514
+ });
9515
+ };
9516
+
9517
+ /**
9518
+ `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
9519
+ as the catch block of a try/catch statement.
9520
+
9521
+ ```js
9522
+ function findAuthor(){
9523
+ throw new Error('couldn\'t find that author');
9524
+ }
9525
+
9526
+ // synchronous
9527
+ try {
9528
+ findAuthor();
9529
+ } catch(reason) {
9530
+ // something went wrong
9599
9531
  }
9532
+
9533
+ // async with promises
9534
+ findAuthor().catch(function(reason){
9535
+ // something went wrong
9536
+ });
9537
+ ```
9538
+
9539
+ @method catch
9540
+ @param {Function} onRejection
9541
+ @param {String} label optional string for labeling the promise.
9542
+ Useful for tooling.
9543
+ @return {Promise}
9544
+ */
9545
+ Promise.prototype.catch = function (onRejection, label) {
9546
+ return this.then(undefined, onRejection, label);
9547
+ };
9600
9548
 
9601
- Promise.prototype._onError = function _onError(reason) {
9602
- var _this = this;
9549
+ /**
9550
+ `finally` will be invoked regardless of the promise's fate just as native
9551
+ try/catch/finally behaves
9552
+
9553
+ Synchronous example:
9554
+
9555
+ ```js
9556
+ findAuthor() {
9557
+ if (Math.random() > 0.5) {
9558
+ throw new Error();
9559
+ }
9560
+ return new Author();
9561
+ }
9562
+
9563
+ try {
9564
+ return findAuthor(); // succeed or fail
9565
+ } catch(error) {
9566
+ return findOtherAuthor();
9567
+ } finally {
9568
+ // always runs
9569
+ // doesn't affect the return value
9570
+ }
9571
+ ```
9572
+
9573
+ Asynchronous example:
9574
+
9575
+ ```js
9576
+ findAuthor().catch(function(reason){
9577
+ return findOtherAuthor();
9578
+ }).finally(function(){
9579
+ // author was either found, or not
9580
+ });
9581
+ ```
9582
+
9583
+ @method finally
9584
+ @param {Function} callback
9585
+ @param {String} label optional string for labeling the promise.
9586
+ Useful for tooling.
9587
+ @return {Promise}
9588
+ */
9589
+ Promise.prototype.finally = function (callback, label) {
9590
+ var promise = this;
9591
+ var constructor = promise.constructor;
9603
9592
 
9604
- config.after(function () {
9605
- if (_this._onError) {
9606
- config.trigger('error', reason, _this._label);
9607
- }
9593
+ return promise.then(function (value) {
9594
+ return constructor.resolve(callback()).then(function () {
9595
+ return value;
9608
9596
  });
9609
- };
9610
-
9611
- Promise.prototype.catch = function _catch(onRejection, label) {
9612
- return this.then(undefined, onRejection, label);
9613
- };
9614
-
9615
- Promise.prototype.finally = function _finally(callback, label) {
9616
- var promise = this;
9617
- var constructor = promise.constructor;
9618
-
9619
- return promise.then(function (value) {
9620
- return constructor.resolve(callback()).then(function () {
9621
- return value;
9622
- });
9623
- }, function (reason) {
9624
- return constructor.resolve(callback()).then(function () {
9625
- throw reason;
9626
- });
9627
- }, label);
9628
- };
9629
-
9630
- return Promise;
9631
- }();
9597
+ }, function (reason) {
9598
+ return constructor.resolve(callback()).then(function () {
9599
+ throw reason;
9600
+ });
9601
+ }, label);
9602
+ };
9632
9603
 
9633
9604
  Promise.cast = resolve$1; // deprecated
9634
9605
  Promise.all = all;