ember-source 1.3.0.beta.4 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ember-source might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c97cbaa7499c9dabda7a41414d0a238bd4c65ef
4
- data.tar.gz: 22fa502c0dd86ea6e46663f2358b2968a8458ce2
3
+ metadata.gz: 68f4bc43988e790e6babed624ac27c9759b6fc85
4
+ data.tar.gz: dc6c3b6b79bf8b4ec31855608d3e08fb7b092eb2
5
5
  SHA512:
6
- metadata.gz: 1afe19e69292627746d80dd1c404b77215f960438b9e0d6e4a8d6eafed5bf6673b80a7792bd7febafaf30ce68a74fa117bebf8804e170b3a0186897cd58eb478
7
- data.tar.gz: cfe522afcb9c327e22aedd7b4185ed86ad2a636c91dfbe28e6dec565397da6eb4208eddd0ee4c84edee5d1d19fb2280bbbab045536fcb2e0133e89ef33dc498b
6
+ metadata.gz: 04984b71ee6536c6492d43dda91fe30205ef62c2288d9d6f4e6985571f742a10396746eb32e7beec002dfad45c137577fd85c5553524babbf0cd55800f033b38
7
+ data.tar.gz: 978d29f785ab6ced0ae5cdd189ecbd2f781f0ce9b35b59e082071cee548c8d9753221744f17648a65d5b959bfa337ad4fed4fdf2d15c52562c7d87e79b937332
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0-beta.4
1
+ 1.3.0
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * @overview Ember - JavaScript Application Framework
3
- * @copyright Copyright 2011-2013 Tilde Inc. and contributors
3
+ * @copyright Copyright 2011-2014 Tilde Inc. and contributors
4
4
  * Portions Copyright 2006-2011 Strobe Inc.
5
5
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
6
6
  * @license Licensed under MIT license
7
7
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
8
- * @version 1.4.0-beta.1+canary.dc0dc0ce
8
+ * @version 1.3.0
9
9
  */
10
10
 
11
11
 
@@ -31,7 +31,20 @@ if ('undefined' === typeof Ember) {
31
31
  }
32
32
  }
33
33
 
34
- Ember.ENV = 'undefined' === typeof ENV ? {} : ENV;
34
+ // This needs to be kept in sync with the logic in
35
+ // `packages/ember-metal/lib/core.js`.
36
+ //
37
+ // This is duplicated here to ensure that `Ember.ENV`
38
+ // is setup even if `Ember` is not loaded yet.
39
+ if (Ember.ENV) {
40
+ // do nothing if Ember.ENV is already setup
41
+ } else if ('undefined' !== typeof EmberENV) {
42
+ Ember.ENV = EmberENV;
43
+ } else if('undefined' !== typeof ENV) {
44
+ Ember.ENV = ENV;
45
+ } else {
46
+ Ember.ENV = {};
47
+ }
35
48
 
36
49
  if (!('MANDATORY_SETTER' in Ember.ENV)) {
37
50
  Ember.ENV.MANDATORY_SETTER = true; // default to true for debug dist
@@ -57,6 +70,11 @@ if (!('MANDATORY_SETTER' in Ember.ENV)) {
57
70
  */
58
71
  Ember.assert = function(desc, test) {
59
72
  if (!test) {
73
+ Ember.Logger.assert(test, desc);
74
+ }
75
+
76
+ if (Ember.testing && !test) {
77
+ // when testing, ensure test failures when assertions fail
60
78
  throw new Ember.Error("Assertion Failed: " + desc);
61
79
  }
62
80
  };
@@ -180,12 +198,12 @@ if (!Ember.testing) {
180
198
 
181
199
  /*!
182
200
  * @overview Ember - JavaScript Application Framework
183
- * @copyright Copyright 2011-2013 Tilde Inc. and contributors
201
+ * @copyright Copyright 2011-2014 Tilde Inc. and contributors
184
202
  * Portions Copyright 2006-2011 Strobe Inc.
185
203
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
186
204
  * @license Licensed under MIT license
187
205
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
188
- * @version 1.4.0-beta.1+canary.dc0dc0ce
206
+ * @version 1.3.0
189
207
  */
190
208
 
191
209
 
@@ -244,7 +262,7 @@ var define, requireModule, require, requirejs;
244
262
  };
245
263
  })();
246
264
  (function() {
247
- /*globals Em:true ENV */
265
+ /*globals Em:true ENV EmberENV MetamorphENV:true */
248
266
 
249
267
  /**
250
268
  @module ember
@@ -268,7 +286,7 @@ var define, requireModule, require, requirejs;
268
286
 
269
287
  @class Ember
270
288
  @static
271
- @version 1.4.0-beta.1+canary.dc0dc0ce
289
+ @version 1.3.0
272
290
  */
273
291
 
274
292
  if ('undefined' === typeof Ember) {
@@ -295,33 +313,46 @@ Ember.toString = function() { return "Ember"; };
295
313
  /**
296
314
  @property VERSION
297
315
  @type String
298
- @default '1.4.0-beta.1+canary.dc0dc0ce'
299
- @final
316
+ @default '1.3.0'
317
+ @static
300
318
  */
301
- Ember.VERSION = '1.4.0-beta.1+canary.dc0dc0ce';
319
+ Ember.VERSION = '1.3.0';
302
320
 
303
321
  /**
304
- Standard environmental variables. You can define these in a global `ENV`
305
- variable before loading Ember to control various configuration
306
- settings.
322
+ Standard environmental variables. You can define these in a global `EmberENV`
323
+ variable before loading Ember to control various configuration settings.
324
+
325
+ For backwards compatibility with earlier versions of Ember the global `ENV`
326
+ variable will be used if `EmberENV` is not defined.
307
327
 
308
328
  @property ENV
309
329
  @type Hash
310
330
  */
311
331
 
312
- if ('undefined' === typeof ENV) {
313
- exports.ENV = {};
332
+ // This needs to be kept in sync with the logic in
333
+ // `packages/ember-debug/lib/main.js`.
334
+ if (Ember.ENV) {
335
+ // do nothing if Ember.ENV is already setup
336
+ } else if ('undefined' !== typeof EmberENV) {
337
+ Ember.ENV = EmberENV;
338
+ } else if('undefined' !== typeof ENV) {
339
+ Ember.ENV = ENV;
340
+ } else {
341
+ Ember.ENV = {};
314
342
  }
315
343
 
344
+ Ember.config = Ember.config || {};
345
+
316
346
  // We disable the RANGE API by default for performance reasons
317
- if ('undefined' === typeof ENV.DISABLE_RANGE_API) {
318
- ENV.DISABLE_RANGE_API = true;
347
+ if ('undefined' === typeof Ember.ENV.DISABLE_RANGE_API) {
348
+ Ember.ENV.DISABLE_RANGE_API = true;
319
349
  }
320
350
 
351
+ if ("undefined" === typeof MetamorphENV) {
352
+ exports.MetamorphENV = {};
353
+ }
321
354
 
322
- Ember.ENV = Ember.ENV || ENV;
323
-
324
- Ember.config = Ember.config || {};
355
+ MetamorphENV.DISABLE_RANGE_API = Ember.ENV.DISABLE_RANGE_API;
325
356
 
326
357
  /**
327
358
  Hash of enabled Canary features. Add to before creating your application.
@@ -847,10 +878,9 @@ Ember.Error.prototype = Ember.create(Error.prototype);
847
878
  Ember.onerror = null;
848
879
 
849
880
  /**
850
- @private
851
-
852
881
  Wrap code block in a try/catch if `Ember.onerror` is set.
853
882
 
883
+ @private
854
884
  @method handleErrors
855
885
  @for Ember
856
886
  @param {Function} func
@@ -880,10 +910,8 @@ Ember.handleErrors = function(func, context) {
880
910
  */
881
911
 
882
912
  /**
883
- @private
884
-
885
913
  Prefix used for guids through out Ember.
886
-
914
+ @private
887
915
  */
888
916
  Ember.GUID_PREFIX = 'ember';
889
917
 
@@ -899,8 +927,6 @@ var o_defineProperty = Ember.platform.defineProperty,
899
927
  var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;
900
928
 
901
929
  /**
902
- @private
903
-
904
930
  A unique key used to assign guids and other private metadata to objects.
905
931
  If you inspect an object in your browser debugger you will often see these.
906
932
  They can be safely ignored.
@@ -908,6 +934,7 @@ var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;
908
934
  On browsers that support it, these properties are added with enumeration
909
935
  disabled so they won't show up when you iterate over your properties.
910
936
 
937
+ @private
911
938
  @property GUID_KEY
912
939
  @for Ember
913
940
  @type String
@@ -923,12 +950,11 @@ var GUID_DESC = {
923
950
  };
924
951
 
925
952
  /**
926
- @private
927
-
928
953
  Generates a new guid, optionally saving the guid to the object that you
929
954
  pass in. You will rarely need to use this method. Instead you should
930
955
  call `Ember.guidFor(obj)`, which return an existing guid if available.
931
956
 
957
+ @private
932
958
  @method generateGuid
933
959
  @for Ember
934
960
  @param {Object} [obj] Object the guid will be used for. If passed in, the guid will
@@ -951,8 +977,6 @@ Ember.generateGuid = function generateGuid(obj, prefix) {
951
977
  };
952
978
 
953
979
  /**
954
- @private
955
-
956
980
  Returns a unique id for the object. If the object does not yet have a guid,
957
981
  one will be assigned to it. You can call this on any object,
958
982
  `Ember.Object`-based or not, but be aware that it will add a `_guid`
@@ -960,6 +984,7 @@ Ember.generateGuid = function generateGuid(obj, prefix) {
960
984
 
961
985
  You can also use this method on DOM Element objects.
962
986
 
987
+ @private
963
988
  @method guidFor
964
989
  @for Ember
965
990
  @param {Object} obj any object, string, number, Element, or primitive
@@ -1024,18 +1049,6 @@ var META_KEY = Ember.GUID_KEY+'_meta';
1024
1049
  */
1025
1050
  Ember.META_KEY = META_KEY;
1026
1051
 
1027
- // Placeholder for non-writable metas.
1028
- var EMPTY_META = {
1029
- descs: {},
1030
- watching: {}
1031
- };
1032
-
1033
- if (MANDATORY_SETTER) { EMPTY_META.values = {}; }
1034
-
1035
- Ember.EMPTY_META = EMPTY_META;
1036
-
1037
- if (Object.freeze) Object.freeze(EMPTY_META);
1038
-
1039
1052
  var isDefinePropertySimulated = Ember.platform.defineProperty.isSimulated;
1040
1053
 
1041
1054
  function Meta(obj) {
@@ -1045,6 +1058,20 @@ function Meta(obj) {
1045
1058
  this.source = obj;
1046
1059
  }
1047
1060
 
1061
+ Meta.prototype = {
1062
+ descs: null,
1063
+ deps: null,
1064
+ watching: null,
1065
+ listeners: null,
1066
+ cache: null,
1067
+ source: null,
1068
+ mixins: null,
1069
+ bindings: null,
1070
+ chains: null,
1071
+ chainWatchers: null,
1072
+ values: null
1073
+ };
1074
+
1048
1075
  if (isDefinePropertySimulated) {
1049
1076
  // on platforms that don't support enumerable false
1050
1077
  // make meta fail jQuery.isPlainObject() to hide from
@@ -1057,6 +1084,13 @@ if (isDefinePropertySimulated) {
1057
1084
  Meta.prototype.toJSON = function () { };
1058
1085
  }
1059
1086
 
1087
+ // Placeholder for non-writable metas.
1088
+ var EMPTY_META = new Meta(null);
1089
+
1090
+ if (MANDATORY_SETTER) { EMPTY_META.values = {}; }
1091
+
1092
+ Ember.EMPTY_META = EMPTY_META;
1093
+
1060
1094
  /**
1061
1095
  Retrieves the meta hash for an object. If `writable` is true ensures the
1062
1096
  hash is writable for this object as well.
@@ -1176,12 +1210,11 @@ Ember.metaPath = function metaPath(obj, path, writable) {
1176
1210
  };
1177
1211
 
1178
1212
  /**
1179
- @private
1180
-
1181
1213
  Wraps the passed function so that `this._super` will point to the superFunc
1182
1214
  when the function is invoked. This is the primitive we use to implement
1183
1215
  calls to super.
1184
1216
 
1217
+ @private
1185
1218
  @method wrap
1186
1219
  @for Ember
1187
1220
  @param {Function} func The function to call
@@ -1491,6 +1524,8 @@ var toString = Object.prototype.toString;
1491
1524
  | 'undefined' | Undefined value |
1492
1525
  | 'function' | A function |
1493
1526
  | 'array' | An instance of Array |
1527
+ | 'regexp' | An instance of RegExp |
1528
+ | 'date' | An instance of Date |
1494
1529
  | 'class' | An Ember class (created using Ember.Object.extend()) |
1495
1530
  | 'instance' | An Ember object instance |
1496
1531
  | 'error' | An instance of the Error object |
@@ -1510,6 +1545,8 @@ var toString = Object.prototype.toString;
1510
1545
  Ember.typeOf(new Boolean(true)); // 'boolean'
1511
1546
  Ember.typeOf(Ember.makeArray); // 'function'
1512
1547
  Ember.typeOf([1,2,90]); // 'array'
1548
+ Ember.typeOf(/abc/); // 'regexp'
1549
+ Ember.typeOf(new Date()); // 'date'
1513
1550
  Ember.typeOf(Ember.Object.extend()); // 'class'
1514
1551
  Ember.typeOf(Ember.Object.create()); // 'instance'
1515
1552
  Ember.typeOf(new Error('teamocil')); // 'error'
@@ -1533,47 +1570,12 @@ Ember.typeOf = function(item) {
1533
1570
  } else if (ret === 'object') {
1534
1571
  if (item instanceof Error) ret = 'error';
1535
1572
  else if (Ember.Object && item instanceof Ember.Object) ret = 'instance';
1536
- else ret = 'object';
1573
+ else if (item instanceof Date) ret = 'date';
1537
1574
  }
1538
1575
 
1539
1576
  return ret;
1540
1577
  };
1541
1578
 
1542
- /**
1543
- Convenience method to inspect an object. This method will attempt to
1544
- convert the object into a useful string description.
1545
-
1546
- It is a pretty simple implementation. If you want something more robust,
1547
- use something like JSDump: https://github.com/NV/jsDump
1548
-
1549
- @method inspect
1550
- @for Ember
1551
- @param {Object} obj The object you want to inspect.
1552
- @return {String} A description of the object
1553
- */
1554
- Ember.inspect = function(obj) {
1555
- var type = Ember.typeOf(obj);
1556
- if (type === 'array') {
1557
- return '[' + obj + ']';
1558
- }
1559
- if (type !== 'object') {
1560
- return obj + '';
1561
- }
1562
-
1563
- var v, ret = [];
1564
- for(var key in obj) {
1565
- if (obj.hasOwnProperty(key)) {
1566
- v = obj[key];
1567
- if (v === 'toString') { continue; } // ignore useless items
1568
- if (Ember.typeOf(v) === 'function') { v = "function() { ... }"; }
1569
- ret.push(key + ": " + v);
1570
- }
1571
- }
1572
- return "{" + ret.join(", ") + "}";
1573
- };
1574
-
1575
-
1576
-
1577
1579
  })();
1578
1580
 
1579
1581
 
@@ -1957,13 +1959,12 @@ if (Ember.config.overrideAccessors) {
1957
1959
  }
1958
1960
 
1959
1961
  /**
1960
- @private
1961
-
1962
1962
  Normalizes a target/path pair to reflect that actual target/path that should
1963
1963
  be observed, etc. This takes into account passing in global property
1964
1964
  paths (i.e. a path beginning with a captial letter not defined on the
1965
1965
  target) and * separators.
1966
1966
 
1967
+ @private
1967
1968
  @method normalizeTuple
1968
1969
  @for Ember
1969
1970
  @param {Object} target The current target. May be `null`.
@@ -1985,7 +1986,7 @@ var normalizeTuple = Ember.normalizeTuple = function(target, path) {
1985
1986
  }
1986
1987
 
1987
1988
  // must return some kind of path to be valid else other things will break.
1988
- if (!path || path.length===0) throw new Ember.Error('Path cannot be empty');
1989
+ if (!path || path.length===0) throw new Ember.Error('Invalid Path');
1989
1990
 
1990
1991
  return [ target, path ];
1991
1992
  };
@@ -2212,8 +2213,6 @@ function removeListener(obj, eventName, target, method) {
2212
2213
  }
2213
2214
 
2214
2215
  /**
2215
- @private
2216
-
2217
2216
  Suspend listener during callback.
2218
2217
 
2219
2218
  This should only be used by the target of the event listener
@@ -2221,6 +2220,7 @@ function removeListener(obj, eventName, target, method) {
2221
2220
  an object might suspend its property change listener while it is
2222
2221
  setting that property.
2223
2222
 
2223
+ @private
2224
2224
  @method suspendListener
2225
2225
  @for Ember
2226
2226
  @param obj
@@ -2249,11 +2249,9 @@ function suspendListener(obj, eventName, target, method, callback) {
2249
2249
  }
2250
2250
 
2251
2251
  /**
2252
- @private
2253
-
2254
2252
  Suspends multiple listeners during a callback.
2255
2253
 
2256
-
2254
+ @private
2257
2255
  @method suspendListeners
2258
2256
  @for Ember
2259
2257
  @param obj
@@ -2297,10 +2295,9 @@ function suspendListeners(obj, eventNames, target, method, callback) {
2297
2295
  }
2298
2296
 
2299
2297
  /**
2300
- @private
2301
-
2302
2298
  Return a list of currently watched events
2303
2299
 
2300
+ @private
2304
2301
  @method watchedEvents
2305
2302
  @for Ember
2306
2303
  @param obj
@@ -2817,7 +2814,7 @@ var set = function set(obj, keyName, value, tolerant) {
2817
2814
  if (value !== currentValue) {
2818
2815
  Ember.propertyWillChange(obj, keyName);
2819
2816
  if (MANDATORY_SETTER) {
2820
- if (currentValue === undefined && !(keyName in obj)) {
2817
+ if ((currentValue === undefined && !(keyName in obj)) || !obj.propertyIsEnumerable(keyName)) {
2821
2818
  Ember.defineProperty(obj, keyName, null, value); // setup mandatory setter
2822
2819
  } else {
2823
2820
  meta.values[keyName] = value;
@@ -3456,8 +3453,6 @@ var DEFAULT_GETTER_FUNCTION = Ember.DEFAULT_GETTER_FUNCTION = function(name) {
3456
3453
  };
3457
3454
 
3458
3455
  /**
3459
- @private
3460
-
3461
3456
  NOTE: This is a low-level method used by other parts of the API. You almost
3462
3457
  never want to call this method directly. Instead you should use
3463
3458
  `Ember.mixin()` to define new properties.
@@ -3491,6 +3486,7 @@ var DEFAULT_GETTER_FUNCTION = Ember.DEFAULT_GETTER_FUNCTION = function(name) {
3491
3486
  }).property('firstName', 'lastName'));
3492
3487
  ```
3493
3488
 
3489
+ @private
3494
3490
  @method defineProperty
3495
3491
  @for Ember
3496
3492
  @param {Object} obj the object to define this property on. This may be a prototype.
@@ -3667,7 +3663,7 @@ Ember.watchKey = function(obj, keyName) {
3667
3663
  m.values[keyName] = obj[keyName];
3668
3664
  o_defineProperty(obj, keyName, {
3669
3665
  configurable: true,
3670
- enumerable: true,
3666
+ enumerable: obj.propertyIsEnumerable(keyName),
3671
3667
  set: Ember.MANDATORY_SETTER_FUNCTION,
3672
3668
  get: Ember.DEFAULT_GETTER_FUNCTION(keyName)
3673
3669
  });
@@ -3691,11 +3687,19 @@ Ember.unwatchKey = function(obj, keyName) {
3691
3687
  if (MANDATORY_SETTER && keyName in obj) {
3692
3688
  o_defineProperty(obj, keyName, {
3693
3689
  configurable: true,
3694
- enumerable: true,
3695
- writable: true,
3696
- value: m.values[keyName]
3690
+ enumerable: obj.propertyIsEnumerable(keyName),
3691
+ set: function(val) {
3692
+ // redefine to set as enumerable
3693
+ o_defineProperty(obj, keyName, {
3694
+ configurable: true,
3695
+ writable: true,
3696
+ enumerable: true,
3697
+ value: val
3698
+ });
3699
+ delete m.values[keyName];
3700
+ },
3701
+ get: Ember.DEFAULT_GETTER_FUNCTION(keyName)
3697
3702
  });
3698
- delete m.values[keyName];
3699
3703
  }
3700
3704
  } else if (watching[keyName] > 1) {
3701
3705
  watching[keyName]--;
@@ -4038,52 +4042,6 @@ Ember.finishChains = function(obj) {
4038
4042
 
4039
4043
 
4040
4044
  (function() {
4041
- if (Ember.FEATURES.isEnabled('propertyBraceExpansion')) {
4042
- /**
4043
- @module ember-metal
4044
- */
4045
-
4046
- var forEach = Ember.EnumerableUtils.forEach,
4047
- BRACE_EXPANSION = /^((?:[^\.]*\.)*)\{(.*)\}$/;
4048
-
4049
- /**
4050
- Expands `pattern`, invoking `callback` for each expansion.
4051
-
4052
- The only pattern supported is brace-expansion, anything else will be passed
4053
- once to `callback` directly. Brace expansion can only appear at the end of a
4054
- pattern, for example as the last item in a chain.
4055
-
4056
- Example
4057
- ```js
4058
- function echo(arg){ console.log(arg); }
4059
-
4060
- Ember.expandProperties('foo.bar', echo); //=> 'foo.bar'
4061
- Ember.expandProperties('{foo,bar}', echo); //=> 'foo', 'bar'
4062
- Ember.expandProperties('foo.{bar,baz}', echo); //=> 'foo.bar', 'foo.baz'
4063
- Ember.expandProperties('{foo,bar}.baz', echo); //=> '{foo,bar}.baz'
4064
- ```
4065
-
4066
- @method
4067
- @private
4068
- @param {string} pattern The property pattern to expand.
4069
- @param {function} callback The callback to invoke. It is invoked once per
4070
- expansion, and is passed the expansion.
4071
- */
4072
- Ember.expandProperties = function (pattern, callback) {
4073
- var match, prefix, list;
4074
-
4075
- if (match = BRACE_EXPANSION.exec(pattern)) {
4076
- prefix = match[1];
4077
- list = match[2];
4078
-
4079
- forEach(list.split(','), function (suffix) {
4080
- callback(prefix + suffix);
4081
- });
4082
- } else {
4083
- callback(pattern);
4084
- }
4085
- };
4086
- }
4087
4045
 
4088
4046
  })();
4089
4047
 
@@ -4158,14 +4116,13 @@ function isKeyName(path) {
4158
4116
  }
4159
4117
 
4160
4118
  /**
4161
- @private
4162
-
4163
4119
  Starts watching a property on an object. Whenever the property changes,
4164
4120
  invokes `Ember.propertyWillChange` and `Ember.propertyDidChange`. This is the
4165
4121
  primitive used by observers and dependent keys; usually you will never call
4166
4122
  this method directly but instead use higher level methods like
4167
4123
  `Ember.addObserver()`
4168
4124
 
4125
+ @private
4169
4126
  @method watch
4170
4127
  @for Ember
4171
4128
  @param obj
@@ -4201,12 +4158,11 @@ Ember.unwatch = function(obj, _keyPath) {
4201
4158
  };
4202
4159
 
4203
4160
  /**
4204
- @private
4205
-
4206
4161
  Call on an object when you first beget it from another object. This will
4207
4162
  setup any chained watchers on the object instance as needed. This method is
4208
4163
  safe to call multiple times.
4209
4164
 
4165
+ @private
4210
4166
  @method rewatch
4211
4167
  @for Ember
4212
4168
  @param obj
@@ -4289,9 +4245,6 @@ var get = Ember.get,
4289
4245
  watch = Ember.watch,
4290
4246
  unwatch = Ember.unwatch;
4291
4247
 
4292
- if (Ember.FEATURES.isEnabled('propertyBraceExpansion')) {
4293
- var expandProperties = Ember.expandProperties;
4294
- }
4295
4248
 
4296
4249
  // ..........................................................
4297
4250
  // DEPENDENT KEYS
@@ -4556,18 +4509,9 @@ ComputedPropertyPrototype.readOnly = function(readOnly) {
4556
4509
  ComputedPropertyPrototype.property = function() {
4557
4510
  var args;
4558
4511
 
4559
- if (Ember.FEATURES.isEnabled('propertyBraceExpansion')) {
4560
- var addArg = function (property) {
4561
- args.push(property);
4562
- };
4563
-
4564
- args = [];
4565
- for (var i = 0, l = arguments.length; i < l; i++) {
4566
- expandProperties(arguments[i], addArg);
4567
- }
4568
- } else {
4512
+
4569
4513
  args = a_slice.call(arguments);
4570
- }
4514
+
4571
4515
 
4572
4516
  this._dependentKeys = args;
4573
4517
  return this;
@@ -4696,7 +4640,7 @@ ComputedPropertyPrototype.set = function(obj, keyName, value) {
4696
4640
  funcArgLength, cachedValue, ret;
4697
4641
 
4698
4642
  if (this._readOnly) {
4699
- throw new Ember.Error('Cannot Set: ' + keyName + ' on: ' + Ember.inspect(obj));
4643
+ throw new Ember.Error('Cannot Set: ' + keyName + ' on: ' + obj.toString() );
4700
4644
  }
4701
4645
 
4702
4646
  this._suspended = obj;
@@ -4882,11 +4826,15 @@ registerComputed('empty', function(dependentKey) {
4882
4826
  A computed property that returns true if the value of the dependent
4883
4827
  property is NOT null, an empty string, empty array, or empty function.
4884
4828
 
4829
+ Note: When using `Ember.computed.notEmpty` to watch an array make sure to
4830
+ use the `array.[]` syntax so the computed can subscribe to transitions
4831
+ from empty to non-empty states.
4832
+
4885
4833
  Example
4886
4834
 
4887
4835
  ```javascript
4888
4836
  var Hamster = Ember.Object.extend({
4889
- hasStuff: Ember.computed.notEmpty('backpack')
4837
+ hasStuff: Ember.computed.notEmpty('backpack.[]')
4890
4838
  });
4891
4839
  var hamster = Hamster.create({backpack: ['Food', 'Sleeping Bag', 'Tent']});
4892
4840
  hamster.get('hasStuff'); // true
@@ -5266,7 +5214,7 @@ registerComputedWithProperties('any', function(properties) {
5266
5214
 
5267
5215
  ```javascript
5268
5216
  var Hamster = Ember.Object.extend({
5269
- clothes: Ember.computed.map('hat', 'shirt')
5217
+ clothes: Ember.computed.collect('hat', 'shirt')
5270
5218
  });
5271
5219
  var hamster = Hamster.create();
5272
5220
  hamster.get('clothes'); // [null, null]
@@ -5275,7 +5223,7 @@ registerComputedWithProperties('any', function(properties) {
5275
5223
  hamster.get('clothes'); // ['Camp Hat', 'Camp Shirt']
5276
5224
  ```
5277
5225
 
5278
- @method computed.map
5226
+ @method computed.collect
5279
5227
  @for Ember
5280
5228
  @param {String} dependentKey*
5281
5229
  @return {Ember.ComputedProperty} computed property which maps
@@ -5373,51 +5321,7 @@ Ember.computed.oneWay = function(dependentKey) {
5373
5321
  });
5374
5322
  };
5375
5323
 
5376
- if (Ember.FEATURES.isEnabled('computed-read-only')) {
5377
- /**
5378
- Where `computed.oneWay` provides oneWay bindings, `computed.readOnly` provides
5379
- a readOnly one way binding. Very often when using `computed.oneWay` one does
5380
- not also want changes to propogate back up, as they will replace the value.
5381
-
5382
- This prevents the reverse flow, and also throws an exception when it occurs.
5383
-
5384
- Example
5385
-
5386
- ```javascript
5387
- User = Ember.Object.extend({
5388
- firstName: null,
5389
- lastName: null,
5390
- nickName: Ember.computed.readOnly('firstName')
5391
- });
5392
-
5393
- user = User.create({
5394
- firstName: 'Teddy',
5395
- lastName: 'Zeenny'
5396
- });
5397
-
5398
- user.get('nickName');
5399
- # 'Teddy'
5400
-
5401
- user.set('nickName', 'TeddyBear');
5402
- # throws Exception
5403
- # throw new Ember.Error('Cannot Set: nickName on: <User:ember27288>' );`
5404
-
5405
- user.get('firstName');
5406
- # 'Teddy'
5407
- ```
5408
5324
 
5409
- @method computed.readOnly
5410
- @for Ember
5411
- @param {String} dependentKey
5412
- @return {Ember.ComputedProperty} computed property which creates a
5413
- one way computed property to the original value for property.
5414
- */
5415
- Ember.computed.readOnly = function(dependentKey) {
5416
- return Ember.computed(dependentKey, function() {
5417
- return get(this, dependentKey);
5418
- }).readOnly();
5419
- };
5420
- }
5421
5325
  /**
5422
5326
  A computed property that acts like a standard getter and setter,
5423
5327
  but returns the value at the provided `defaultPath` if the
@@ -5566,7 +5470,7 @@ Ember.removeBeforeObserver = function(obj, _path, target, method) {
5566
5470
 
5567
5471
 
5568
5472
  (function() {
5569
- define("backburner/queue",
5473
+ define("backburner/queue",
5570
5474
  ["exports"],
5571
5475
  function(__exports__) {
5572
5476
  "use strict";
@@ -5673,10 +5577,11 @@ define("backburner/queue",
5673
5577
  }
5674
5578
  };
5675
5579
 
5580
+
5676
5581
  __exports__.Queue = Queue;
5677
5582
  });
5678
5583
 
5679
- define("backburner/deferred_action_queues",
5584
+ define("backburner/deferred_action_queues",
5680
5585
  ["backburner/queue","exports"],
5681
5586
  function(__dependency1__, __exports__) {
5682
5587
  "use strict";
@@ -5775,10 +5680,11 @@ define("backburner/deferred_action_queues",
5775
5680
  return -1;
5776
5681
  }
5777
5682
 
5683
+
5778
5684
  __exports__.DeferredActionQueues = DeferredActionQueues;
5779
5685
  });
5780
5686
 
5781
- define("backburner",
5687
+ define("backburner",
5782
5688
  ["backburner/deferred_action_queues","exports"],
5783
5689
  function(__dependency1__, __exports__) {
5784
5690
  "use strict";
@@ -5887,7 +5793,7 @@ define("backburner",
5887
5793
  method = target[method];
5888
5794
  }
5889
5795
 
5890
- var stack = this.DEBUG ? new Error().stack : undefined,
5796
+ var stack = this.DEBUG ? new Error() : undefined,
5891
5797
  args = arguments.length > 3 ? slice.call(arguments, 3) : undefined;
5892
5798
  if (!this.currentInstance) { createAutorun(this); }
5893
5799
  return this.currentInstance.schedule(queueName, target, method, args, false, stack);
@@ -5903,7 +5809,7 @@ define("backburner",
5903
5809
  method = target[method];
5904
5810
  }
5905
5811
 
5906
- var stack = this.DEBUG ? new Error().stack : undefined,
5812
+ var stack = this.DEBUG ? new Error() : undefined,
5907
5813
  args = arguments.length > 3 ? slice.call(arguments, 3) : undefined;
5908
5814
  if (!this.currentInstance) { createAutorun(this); }
5909
5815
  return this.currentInstance.schedule(queueName, target, method, args, true, stack);
@@ -6203,9 +6109,9 @@ define("backburner",
6203
6109
  return index;
6204
6110
  }
6205
6111
 
6112
+
6206
6113
  __exports__.Backburner = Backburner;
6207
6114
  });
6208
-
6209
6115
  })();
6210
6116
 
6211
6117
 
@@ -6287,7 +6193,6 @@ Ember.run = function(target, method) {
6287
6193
 
6288
6194
  If invoked when not within a run loop:
6289
6195
 
6290
-
6291
6196
  ```javascript
6292
6197
  Ember.run.join(function() {
6293
6198
  // creates a new run-loop
@@ -6296,7 +6201,6 @@ Ember.run = function(target, method) {
6296
6201
 
6297
6202
  Alternatively, if called within an existing run loop:
6298
6203
 
6299
-
6300
6204
  ```javascript
6301
6205
  Ember.run(function() {
6302
6206
  // creates a new run-loop
@@ -6314,7 +6218,7 @@ Ember.run = function(target, method) {
6314
6218
  May be a function or a string. If you pass a string
6315
6219
  then it will be looked up on the passed target.
6316
6220
  @param {Object} [args*] Any additional arguments you wish to pass to the method.
6317
- @return {Object} return value from invoking the passed function. Please note,
6221
+ @return {Object} Return value from invoking the passed function. Please note,
6318
6222
  when called within an existing loop, no return value is possible.
6319
6223
  */
6320
6224
  Ember.run.join = function(target, method) {
@@ -6403,7 +6307,8 @@ Ember.run.end = function() {
6403
6307
  console.log("scheduled on actions queue");
6404
6308
  });
6405
6309
 
6406
- // Note the functions will be run in order based on the run queues order. Output would be:
6310
+ // Note the functions will be run in order based on the run queues order.
6311
+ // Output would be:
6407
6312
  // scheduled on sync queue
6408
6313
  // scheduled on actions queue
6409
6314
  ```
@@ -6495,7 +6400,7 @@ Ember.run.later = function(target, method) {
6495
6400
  If you pass a string it will be resolved on the
6496
6401
  target at the time the method is invoked.
6497
6402
  @param {Object} [args*] Optional arguments to pass to the timeout.
6498
- @return {Object} Timer information for use in cancelling, see `Ember.run.cancel`.
6403
+ @return {Object} timer
6499
6404
  */
6500
6405
  Ember.run.once = function(target, method) {
6501
6406
  checkAutoRun();
@@ -6546,7 +6451,7 @@ Ember.run.once = function(target, method) {
6546
6451
  If you pass a string it will be resolved on the
6547
6452
  target at the time the method is invoked.
6548
6453
  @param {Object} [args*] Optional arguments to pass to the timeout.
6549
- @return {Object} Timer information for use in cancelling, see `Ember.run.cancel`.
6454
+ @return {Object} timer
6550
6455
  */
6551
6456
  Ember.run.scheduleOnce = function(queue, target, method) {
6552
6457
  checkAutoRun();
@@ -6560,7 +6465,8 @@ Ember.run.scheduleOnce = function(queue, target, method) {
6560
6465
 
6561
6466
  ```javascript
6562
6467
  Ember.run.next(myContext, function() {
6563
- // code to be executed in the next run loop, which will be scheduled after the current one
6468
+ // code to be executed in the next run loop,
6469
+ // which will be scheduled after the current one
6564
6470
  });
6565
6471
  ```
6566
6472
 
@@ -6608,7 +6514,7 @@ Ember.run.scheduleOnce = function(queue, target, method) {
6608
6514
  If you pass a string it will be resolved on the
6609
6515
  target at the time the method is invoked.
6610
6516
  @param {Object} [args*] Optional arguments to pass to the timeout.
6611
- @return {Object} Timer information for use in cancelling, see `Ember.run.cancel`.
6517
+ @return {Object} timer
6612
6518
  */
6613
6519
  Ember.run.next = function() {
6614
6520
  var args = slice.call(arguments);
@@ -6618,8 +6524,7 @@ Ember.run.next = function() {
6618
6524
 
6619
6525
  /**
6620
6526
  Cancels a scheduled item. Must be a value returned by `Ember.run.later()`,
6621
- `Ember.run.once()`, `Ember.run.next()`, `Ember.run.debounce()`, or
6622
- `Ember.run.throttle()`.
6527
+ `Ember.run.once()`, or `Ember.run.next()`.
6623
6528
 
6624
6529
  ```javascript
6625
6530
  var runNext = Ember.run.next(myContext, function() {
@@ -6636,29 +6541,11 @@ Ember.run.next = function() {
6636
6541
  // will not be executed
6637
6542
  });
6638
6543
  Ember.run.cancel(runOnce);
6639
-
6640
- var throttle = Ember.run.throttle(myContext, function() {
6641
- // will not be executed
6642
- }, 1);
6643
- Ember.run.cancel(throttle);
6644
-
6645
- var debounce = Ember.run.debounce(myContext, function() {
6646
- // will not be executed
6647
- }, 1);
6648
- Ember.run.cancel(debounce);
6649
-
6650
- var debounceImmediate = Ember.run.debounce(myContext, function() {
6651
- // will be executed since we passed in true (immediate)
6652
- }, 100, true);
6653
- // the 100ms delay until this method can be called again will be cancelled
6654
- Ember.run.cancel(debounceImmediate);
6655
- ```
6656
- ```
6657
6544
  ```
6658
6545
 
6659
6546
  @method cancel
6660
6547
  @param {Object} timer Timer object to cancel
6661
- @return {Boolean} true if cancelled or false/undefined if it wasn't found
6548
+ @return {void}
6662
6549
  */
6663
6550
  Ember.run.cancel = function(timer) {
6664
6551
  return backburner.cancel(timer);
@@ -6690,34 +6577,6 @@ Ember.run.cancel = function(timer) {
6690
6577
  // console logs 'debounce ran.' one time.
6691
6578
  ```
6692
6579
 
6693
- Immediate allows you to run the function immediately, but debounce
6694
- other calls for this function until the wait time has elapsed. If
6695
- `debounce` is called again before the specified time has elapsed,
6696
- the timer is reset and the entire period msut pass again before
6697
- the method can be called again.
6698
-
6699
- ```javascript
6700
- var myFunc = function() { console.log(this.name + ' ran.'); };
6701
- var myContext = {name: 'debounce'};
6702
-
6703
- Ember.run.debounce(myContext, myFunc, 150, true);
6704
-
6705
- // console logs 'debounce ran.' one time immediately.
6706
- // 100ms passes
6707
-
6708
- Ember.run.debounce(myContext, myFunc, 150, true);
6709
-
6710
- // 150ms passes and nothing else is logged to the console and
6711
- // the debouncee is no longer being watched
6712
-
6713
- Ember.run.debounce(myContext, myFunc, 150, true);
6714
-
6715
- // console logs 'debounce ran.' one time immediately.
6716
- // 150ms passes and nothing else is logged tot he console and
6717
- // the debouncee is no longer being watched
6718
-
6719
- ```
6720
-
6721
6580
  @method debounce
6722
6581
  @param {Object} [target] target of method to invoke
6723
6582
  @param {Function|String} method The method to invoke.
@@ -6726,7 +6585,7 @@ Ember.run.cancel = function(timer) {
6726
6585
  @param {Object} [args*] Optional arguments to pass to the timeout.
6727
6586
  @param {Number} wait Number of milliseconds to wait.
6728
6587
  @param {Boolean} immediate Trigger the function on the leading instead of the trailing edge of the wait interval.
6729
- @return {Array} Timer information for use in cancelling, see `Ember.run.cancel`.
6588
+ @return {void}
6730
6589
  */
6731
6590
  Ember.run.debounce = function() {
6732
6591
  return backburner.debounce.apply(backburner, arguments);
@@ -6763,7 +6622,7 @@ Ember.run.debounce = function() {
6763
6622
  then it will be looked up on the passed target.
6764
6623
  @param {Object} [args*] Optional arguments to pass to the timeout.
6765
6624
  @param {Number} spacing Number of milliseconds to space out requests.
6766
- @return {Array} Timer information for use in cancelling, see `Ember.run.cancel`.
6625
+ @return {void}
6767
6626
  */
6768
6627
  Ember.run.throttle = function() {
6769
6628
  return backburner.throttle.apply(backburner, arguments);
@@ -7273,9 +7132,6 @@ var Mixin, REQUIRED, Alias,
7273
7132
  defineProperty = Ember.defineProperty,
7274
7133
  guidFor = Ember.guidFor;
7275
7134
 
7276
- if (Ember.FEATURES.isEnabled('propertyBraceExpansion')) {
7277
- var expandProperties = Ember.expandProperties;
7278
- }
7279
7135
 
7280
7136
  function mixinsMeta(obj) {
7281
7137
  var m = Ember.meta(obj, true), ret = m.mixins;
@@ -7456,7 +7312,8 @@ function mergeMixins(mixins, m, descs, values, base, keys) {
7456
7312
 
7457
7313
  for(var i=0, l=mixins.length; i<l; i++) {
7458
7314
  mixin = mixins[i];
7459
- Ember.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(mixin), typeof mixin === 'object' && mixin !== null && Object.prototype.toString.call(mixin) !== '[object Array]');
7315
+ Ember.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(mixin),
7316
+ typeof mixin === 'object' && mixin !== null && Object.prototype.toString.call(mixin) !== '[object Array]');
7460
7317
 
7461
7318
  props = mixinProperties(m, mixin);
7462
7319
  if (props === CONTINUE) { continue; }
@@ -7729,7 +7586,8 @@ MixinPrototype.reopen = function() {
7729
7586
 
7730
7587
  for(idx=0; idx < len; idx++) {
7731
7588
  mixin = arguments[idx];
7732
- Ember.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(mixin), typeof mixin === 'object' && mixin !== null && Object.prototype.toString.call(mixin) !== '[object Array]');
7589
+ Ember.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(mixin),
7590
+ typeof mixin === 'object' && mixin !== null && Object.prototype.toString.call(mixin) !== '[object Array]');
7733
7591
 
7734
7592
  if (mixin instanceof Mixin) {
7735
7593
  mixins.push(mixin);
@@ -7849,6 +7707,35 @@ Alias = function(methodName) {
7849
7707
  };
7850
7708
  Alias.prototype = new Ember.Descriptor();
7851
7709
 
7710
+ /**
7711
+ Makes a property or method available via an additional name.
7712
+
7713
+ ```javascript
7714
+ App.PaintSample = Ember.Object.extend({
7715
+ color: 'red',
7716
+ colour: Ember.alias('color'),
7717
+ name: function() {
7718
+ return "Zed";
7719
+ },
7720
+ moniker: Ember.alias("name")
7721
+ });
7722
+
7723
+ var paintSample = App.PaintSample.create()
7724
+ paintSample.get('colour'); // 'red'
7725
+ paintSample.moniker(); // 'Zed'
7726
+ ```
7727
+
7728
+ @method alias
7729
+ @for Ember
7730
+ @param {String} methodName name of the method or property to alias
7731
+ @return {Ember.Descriptor}
7732
+ @deprecated Use `Ember.aliasMethod` or `Ember.computed.alias` instead
7733
+ */
7734
+ Ember.alias = function(methodName) {
7735
+ Ember.deprecate("Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead.");
7736
+ return new Alias(methodName);
7737
+ };
7738
+
7852
7739
  /**
7853
7740
  Makes a method available via an additional name.
7854
7741
 
@@ -7903,23 +7790,7 @@ Ember.observer = function() {
7903
7790
  var func = a_slice.call(arguments, -1)[0];
7904
7791
  var paths;
7905
7792
 
7906
- if (Ember.FEATURES.isEnabled('propertyBraceExpansion')) {
7907
- var addWatchedProperty = function (path) { paths.push(path); };
7908
- var _paths = a_slice.call(arguments, 0, -1);
7909
-
7910
- if (typeof func !== "function") {
7911
- // revert to old, soft-deprecated argument ordering
7912
-
7913
- func = arguments[0];
7914
- _paths = a_slice.call(arguments, 1);
7915
- }
7916
-
7917
- paths = [];
7918
-
7919
- for (var i=0; i<_paths.length; ++i) {
7920
- expandProperties(_paths[i], addWatchedProperty);
7921
- }
7922
- } else {
7793
+
7923
7794
  paths = a_slice.call(arguments, 0, -1);
7924
7795
 
7925
7796
  if (typeof func !== "function") {
@@ -7928,7 +7799,7 @@ Ember.observer = function() {
7928
7799
  func = arguments[0];
7929
7800
  paths = a_slice.call(arguments, 1);
7930
7801
  }
7931
- }
7802
+
7932
7803
 
7933
7804
  if (typeof func !== "function") {
7934
7805
  throw new Ember.Error("Ember.observer called without a function");
@@ -8017,24 +7888,7 @@ Ember.beforeObserver = function() {
8017
7888
  var func = a_slice.call(arguments, -1)[0];
8018
7889
  var paths;
8019
7890
 
8020
- if (Ember.FEATURES.isEnabled('propertyBraceExpansion')) {
8021
- var addWatchedProperty = function(path) { paths.push(path); };
8022
-
8023
- var _paths = a_slice.call(arguments, 0, -1);
8024
-
8025
- if (typeof func !== "function") {
8026
- // revert to old, soft-deprecated argument ordering
8027
-
8028
- func = arguments[0];
8029
- _paths = a_slice.call(arguments, 1);
8030
- }
8031
-
8032
- paths = [];
8033
-
8034
- for (var i=0; i<_paths.length; ++i) {
8035
- expandProperties(_paths[i], addWatchedProperty);
8036
- }
8037
- } else {
7891
+
8038
7892
  paths = a_slice.call(arguments, 0, -1);
8039
7893
 
8040
7894
  if (typeof func !== "function") {
@@ -8043,7 +7897,7 @@ Ember.beforeObserver = function() {
8043
7897
  func = arguments[0];
8044
7898
  paths = a_slice.call(arguments, 1);
8045
7899
  }
8046
- }
7900
+
8047
7901
 
8048
7902
  if (typeof func !== "function") {
8049
7903
  throw new Ember.Error("Ember.beforeObserver called without a function");
@@ -8122,76 +7976,110 @@ Ember Metal
8122
7976
  @module RSVP
8123
7977
  */
8124
7978
  define("rsvp/all",
8125
- ["./promise","./utils","exports"],
8126
- function(__dependency1__, __dependency2__, __exports__) {
7979
+ ["./promise","exports"],
7980
+ function(__dependency1__, __exports__) {
8127
7981
  "use strict";
8128
- /* global toString */
8129
-
8130
- var Promise = __dependency1__.Promise;
8131
- var isArray = __dependency2__.isArray;
8132
- var isFunction = __dependency2__.isFunction;
7982
+ var Promise = __dependency1__["default"];
8133
7983
 
8134
7984
  /**
8135
- Returns a promise that is fulfilled when all the given promises have been
8136
- fulfilled, or rejected if any of them become rejected. The return promise
8137
- is fulfilled with an array that gives all the values in the order they were
8138
- passed in the `promises` array argument.
7985
+ This is a convenient alias for `RSVP.Promise.all`.
8139
7986
 
8140
- Example:
7987
+ @method all
7988
+ @for RSVP
7989
+ @param {Array} array Array of promises.
7990
+ @param {String} label An optional label. This is useful
7991
+ for tooling.
7992
+ @static
7993
+ */
7994
+ __exports__["default"] = function all(array, label) {
7995
+ return Promise.all(array, label);
7996
+ };
7997
+ });
7998
+ define("rsvp/all_settled",
7999
+ ["./promise","./utils","exports"],
8000
+ function(__dependency1__, __dependency2__, __exports__) {
8001
+ "use strict";
8002
+ var Promise = __dependency1__["default"];
8003
+ var isArray = __dependency2__.isArray;
8004
+ var isNonThenable = __dependency2__.isNonThenable;
8141
8005
 
8142
- ```javascript
8143
- var promise1 = RSVP.resolve(1);
8144
- var promise2 = RSVP.resolve(2);
8145
- var promise3 = RSVP.resolve(3);
8146
- var promises = [ promise1, promise2, promise3 ];
8006
+ /**
8007
+ `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing
8008
+ a fail-fast method, it waits until all the promises have returned and
8009
+ shows you all the results. This is useful if you want to handle multiple
8010
+ promises' failure states together as a set.
8147
8011
 
8148
- RSVP.all(promises).then(function(array){
8149
- // The array here would be [ 1, 2, 3 ];
8150
- });
8151
- ```
8012
+ Returns a promise that is fulfilled when all the given promises have been
8013
+ settled. The return promise is fulfilled with an array of the states of
8014
+ the promises passed into the `promises` array argument.
8152
8015
 
8153
- If any of the `promises` given to `RSVP.all` are rejected, the first promise
8154
- that is rejected will be given as an argument to the returned promises's
8155
- rejection handler. For example:
8016
+ Each state object will either indicate fulfillment or rejection, and
8017
+ provide the corresponding value or reason. The states will take one of
8018
+ the following formats:
8019
+
8020
+ ```javascript
8021
+ { state: 'fulfilled', value: value }
8022
+ or
8023
+ { state: 'rejected', reason: reason }
8024
+ ```
8156
8025
 
8157
8026
  Example:
8158
8027
 
8159
8028
  ```javascript
8160
- var promise1 = RSVP.resolve(1);
8161
- var promise2 = RSVP.reject(new Error("2"));
8162
- var promise3 = RSVP.reject(new Error("3"));
8029
+ var promise1 = RSVP.Promise.resolve(1);
8030
+ var promise2 = RSVP.Promise.reject(new Error('2'));
8031
+ var promise3 = RSVP.Promise.reject(new Error('3'));
8163
8032
  var promises = [ promise1, promise2, promise3 ];
8164
8033
 
8165
- RSVP.all(promises).then(function(array){
8166
- // Code here never runs because there are rejected promises!
8034
+ RSVP.allSettled(promises).then(function(array){
8035
+ // array == [
8036
+ // { state: 'fulfilled', value: 1 },
8037
+ // { state: 'rejected', reason: Error },
8038
+ // { state: 'rejected', reason: Error }
8039
+ // ]
8040
+ // Note that for the second item, reason.message will be "2", and for the
8041
+ // third item, reason.message will be "3".
8167
8042
  }, function(error) {
8168
- // error.message === "2"
8043
+ // Not run. (This block would only be called if allSettled had failed,
8044
+ // for instance if passed an incorrect argument type.)
8169
8045
  });
8170
8046
  ```
8171
8047
 
8172
- @method all
8048
+ @method allSettled
8173
8049
  @for RSVP
8174
8050
  @param {Array} promises
8175
- @param {String} label
8176
- @return {Promise} promise that is fulfilled when all `promises` have been
8177
- fulfilled, or rejected if any of them become rejected.
8051
+ @param {String} label - optional string that describes the promise.
8052
+ Useful for tooling.
8053
+ @return {Promise} promise that is fulfilled with an array of the settled
8054
+ states of the constituent promises.
8055
+ @static
8178
8056
  */
8179
- function all(promises, label) {
8180
- if (!isArray(promises)) {
8181
- throw new TypeError('You must pass an array to all.');
8182
- }
8183
8057
 
8058
+ __exports__["default"] = function allSettled(entries, label) {
8184
8059
  return new Promise(function(resolve, reject) {
8185
- var results = [], remaining = promises.length,
8186
- promise;
8060
+ if (!isArray(entries)) {
8061
+ throw new TypeError('You must pass an array to allSettled.');
8062
+ }
8063
+
8064
+ var remaining = entries.length;
8065
+ var entry;
8187
8066
 
8188
8067
  if (remaining === 0) {
8189
8068
  resolve([]);
8069
+ return;
8190
8070
  }
8191
8071
 
8192
- function resolver(index) {
8072
+ var results = new Array(remaining);
8073
+
8074
+ function fulfilledResolver(index) {
8193
8075
  return function(value) {
8194
- resolveAll(index, value);
8076
+ resolveAll(index, fulfilled(value));
8077
+ };
8078
+ }
8079
+
8080
+ function rejectedResolver(index) {
8081
+ return function(reason) {
8082
+ resolveAll(index, rejected(reason));
8195
8083
  };
8196
8084
  }
8197
8085
 
@@ -8202,97 +8090,31 @@ define("rsvp/all",
8202
8090
  }
8203
8091
  }
8204
8092
 
8205
- for (var i = 0; i < promises.length; i++) {
8206
- promise = promises[i];
8093
+ for (var index = 0; index < entries.length; index++) {
8094
+ entry = entries[index];
8207
8095
 
8208
- if (promise && isFunction(promise.then)) {
8209
- promise.then(resolver(i), reject, "RSVP: RSVP#all");
8096
+ if (isNonThenable(entry)) {
8097
+ resolveAll(index, fulfilled(entry));
8210
8098
  } else {
8211
- resolveAll(i, promise);
8099
+ Promise.cast(entry).then(fulfilledResolver(index), rejectedResolver(index));
8212
8100
  }
8213
8101
  }
8214
8102
  }, label);
8215
- }
8216
-
8217
- __exports__.all = all;
8218
- });
8219
-
8220
- define("rsvp/cast",
8221
- ["exports"],
8222
- function(__exports__) {
8223
- "use strict";
8224
- /**
8225
- `RSVP.Promise.cast` returns the same promise if that promise shares a constructor
8226
- with the promise being casted.
8227
-
8228
- Example:
8229
-
8230
- ```javascript
8231
- var promise = RSVP.resolve(1);
8232
- var casted = RSVP.Promise.cast(promise);
8233
-
8234
- console.log(promise === casted); // true
8235
- ```
8236
-
8237
- In the case of a promise whose constructor does not match, it is assimilated.
8238
- The resulting promise will fulfill or reject based on the outcome of the
8239
- promise being casted.
8240
-
8241
- In the case of a non-promise, a promise which will fulfill with that value is
8242
- returned.
8243
-
8244
- Example:
8245
-
8246
- ```javascript
8247
- var value = 1; // could be a number, boolean, string, undefined...
8248
- var casted = RSVP.Promise.cast(value);
8249
-
8250
- console.log(value === casted); // false
8251
- console.log(casted instanceof RSVP.Promise) // true
8252
-
8253
- casted.then(function(val) {
8254
- val === value // => true
8255
- });
8256
- ```
8257
-
8258
- `RSVP.Promise.cast` is similar to `RSVP.resolve`, but `RSVP.Promise.cast` differs in the
8259
- following ways:
8260
- * `RSVP.Promise.cast` serves as a memory-efficient way of getting a promise, when you
8261
- have something that could either be a promise or a value. RSVP.resolve
8262
- will have the same effect but will create a new promise wrapper if the
8263
- argument is a promise.
8264
- * `RSVP.Promise.cast` is a way of casting incoming thenables or promise subclasses to
8265
- promises of the exact class specified, so that the resulting object's `then` is
8266
- ensured to have the behavior of the constructor you are calling cast on (i.e., RSVP.Promise).
8267
-
8268
- @method cast
8269
- @for RSVP
8270
- @param {Object} object to be casted
8271
- @return {Promise} promise that is fulfilled when all properties of `promises`
8272
- have been fulfilled, or rejected if any of them become rejected.
8273
- */
8274
-
8275
-
8276
- function cast(object) {
8277
- /*jshint validthis:true */
8278
- if (object && typeof object === 'object' && object.constructor === this) {
8279
- return object;
8280
- }
8281
-
8282
- var Promise = this;
8103
+ };
8283
8104
 
8284
- return new Promise(function(resolve) {
8285
- resolve(object);
8286
- });
8105
+ function fulfilled(value) {
8106
+ return { state: 'fulfilled', value: value };
8287
8107
  }
8288
8108
 
8289
- __exports__.cast = cast;
8109
+ function rejected(reason) {
8110
+ return { state: 'rejected', reason: reason };
8111
+ }
8290
8112
  });
8291
8113
  define("rsvp/config",
8292
8114
  ["./events","exports"],
8293
8115
  function(__dependency1__, __exports__) {
8294
8116
  "use strict";
8295
- var EventTarget = __dependency1__.EventTarget;
8117
+ var EventTarget = __dependency1__["default"];
8296
8118
 
8297
8119
  var config = {
8298
8120
  instrument: false
@@ -8323,10 +8145,10 @@ define("rsvp/defer",
8323
8145
  ["./promise","exports"],
8324
8146
  function(__dependency1__, __exports__) {
8325
8147
  "use strict";
8326
- var Promise = __dependency1__.Promise;
8148
+ var Promise = __dependency1__["default"];
8327
8149
 
8328
8150
  /**
8329
- `RSVP.defer` returns an object similar to jQuery's `$.Deferred` objects.
8151
+ `RSVP.defer` returns an object similar to jQuery's `$.Deferred`.
8330
8152
  `RSVP.defer` should be used when porting over code reliant on `$.Deferred`'s
8331
8153
  interface. New code should use the `RSVP.Promise` constructor instead.
8332
8154
 
@@ -8352,17 +8174,13 @@ define("rsvp/defer",
8352
8174
 
8353
8175
  @method defer
8354
8176
  @for RSVP
8355
- @param {String} -
8177
+ @param {String} label optional string for labeling the promise.
8178
+ Useful for tooling.
8356
8179
  @return {Object}
8357
8180
  */
8358
8181
 
8359
- function defer(label) {
8360
- var deferred = {
8361
- // pre-allocate shape
8362
- resolve: undefined,
8363
- reject: undefined,
8364
- promise: undefined
8365
- };
8182
+ __exports__["default"] = function defer(label) {
8183
+ var deferred = { };
8366
8184
 
8367
8185
  deferred.promise = new Promise(function(resolve, reject) {
8368
8186
  deferred.resolve = resolve;
@@ -8370,9 +8188,7 @@ define("rsvp/defer",
8370
8188
  }, label);
8371
8189
 
8372
8190
  return deferred;
8373
- }
8374
-
8375
- __exports__.defer = defer;
8191
+ };
8376
8192
  });
8377
8193
  define("rsvp/events",
8378
8194
  ["exports"],
@@ -8397,13 +8213,11 @@ define("rsvp/events",
8397
8213
  };
8398
8214
 
8399
8215
  /**
8400
- //@module RSVP
8401
- //@class EventTarget
8216
+ @class RSVP.EventTarget
8402
8217
  */
8403
- var EventTarget = {
8218
+ __exports__["default"] = {
8404
8219
 
8405
8220
  /**
8406
- @private
8407
8221
  `RSVP.EventTarget.mixin` extends an object with EventTarget methods. For
8408
8222
  Example:
8409
8223
 
@@ -8442,6 +8256,7 @@ define("rsvp/events",
8442
8256
 
8443
8257
  @method mixin
8444
8258
  @param {Object} object object to extend with EventTarget methods
8259
+ @private
8445
8260
  */
8446
8261
  mixin: function(object) {
8447
8262
  object.on = this.on;
@@ -8452,8 +8267,6 @@ define("rsvp/events",
8452
8267
  },
8453
8268
 
8454
8269
  /**
8455
- @private
8456
-
8457
8270
  Registers a callback to be executed when `eventName` is triggered
8458
8271
 
8459
8272
  ```javascript
@@ -8467,6 +8280,7 @@ define("rsvp/events",
8467
8280
  @method on
8468
8281
  @param {String} eventName name of the event to listen for
8469
8282
  @param {Function} callback function to be called when the event is triggered.
8283
+ @private
8470
8284
  */
8471
8285
  on: function(eventName, callback) {
8472
8286
  var allCallbacks = callbacksFor(this), callbacks;
@@ -8483,8 +8297,6 @@ define("rsvp/events",
8483
8297
  },
8484
8298
 
8485
8299
  /**
8486
- @private
8487
-
8488
8300
  You can use `off` to stop firing a particular callback for an event:
8489
8301
 
8490
8302
  ```javascript
@@ -8520,6 +8332,8 @@ define("rsvp/events",
8520
8332
  given will be removed from the event's callback queue. If no `callback`
8521
8333
  argument is given, all callbacks will be removed from the event's callback
8522
8334
  queue.
8335
+ @private
8336
+
8523
8337
  */
8524
8338
  off: function(eventName, callback) {
8525
8339
  var allCallbacks = callbacksFor(this), callbacks, index;
@@ -8537,8 +8351,6 @@ define("rsvp/events",
8537
8351
  },
8538
8352
 
8539
8353
  /**
8540
- @private
8541
-
8542
8354
  Use `trigger` to fire custom events. For example:
8543
8355
 
8544
8356
  ```javascript
@@ -8565,6 +8377,7 @@ define("rsvp/events",
8565
8377
  @param {String} eventName name of the event to be triggered
8566
8378
  @param {Any} options optional value to be passed to any event handlers for
8567
8379
  the given `eventName`
8380
+ @private
8568
8381
  */
8569
8382
  trigger: function(eventName, options) {
8570
8383
  var allCallbacks = callbacksFor(this),
@@ -8580,25 +8393,130 @@ define("rsvp/events",
8580
8393
  }
8581
8394
  }
8582
8395
  };
8396
+ });
8397
+ define("rsvp/filter",
8398
+ ["./all","./map","./utils","exports"],
8399
+ function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
8400
+ "use strict";
8401
+ var all = __dependency1__["default"];
8402
+ var map = __dependency2__["default"];
8403
+ var isFunction = __dependency3__.isFunction;
8404
+ var isArray = __dependency3__.isArray;
8583
8405
 
8584
- __exports__.EventTarget = EventTarget;
8406
+ /**
8407
+ `RSVP.filter` is similar to JavaScript's native `filter` method, except that it
8408
+ waits for all promises to become fulfilled before running the `filterFn` on
8409
+ each item in given to `promises`. `RSVP.filter` returns a promise that will
8410
+ become fulfilled with the result of running `filterFn` on the values the
8411
+ promises become fulfilled with.
8412
+
8413
+ For example:
8414
+
8415
+ ```javascript
8416
+
8417
+ var promise1 = RSVP.resolve(1);
8418
+ var promise2 = RSVP.resolve(2);
8419
+ var promise3 = RSVP.resolve(3);
8420
+
8421
+ var filterFn = function(item){
8422
+ return item > 1;
8423
+ };
8424
+
8425
+ RSVP.filter(promises, filterFn).then(function(result){
8426
+ // result is [ 2, 3 ]
8427
+ });
8428
+ ```
8429
+
8430
+ If any of the `promises` given to `RSVP.filter` are rejected, the first promise
8431
+ that is rejected will be given as an argument to the returned promise's
8432
+ rejection handler. For example:
8433
+
8434
+ ```javascript
8435
+ var promise1 = RSVP.resolve(1);
8436
+ var promise2 = RSVP.reject(new Error("2"));
8437
+ var promise3 = RSVP.reject(new Error("3"));
8438
+ var promises = [ promise1, promise2, promise3 ];
8439
+
8440
+ var filterFn = function(item){
8441
+ return item > 1;
8442
+ };
8443
+
8444
+ RSVP.filter(promises, filterFn).then(function(array){
8445
+ // Code here never runs because there are rejected promises!
8446
+ }, function(reason) {
8447
+ // reason.message === "2"
8448
+ });
8449
+ ```
8450
+
8451
+ `RSVP.filter` will also wait for any promises returned from `filterFn`.
8452
+ For instance, you may want to fetch a list of users then return a subset
8453
+ of those users based on some asynchronous operation:
8454
+
8455
+ ```javascript
8456
+
8457
+ var alice = { name: 'alice' };
8458
+ var bob = { name: 'bob' };
8459
+ var users = [ alice, bob ];
8460
+
8461
+ var promises = users.map(function(user){
8462
+ return RSVP.resolve(user);
8463
+ });
8464
+
8465
+ var filterFn = function(user){
8466
+ // Here, Alice has permissions to create a blog post, but Bob does not.
8467
+ return getPrivilegesForUser(user).then(function(privs){
8468
+ return privs.can_create_blog_post === true;
8469
+ });
8470
+ };
8471
+ RSVP.filter(promises, filterFn).then(function(users){
8472
+ // true, because the server told us only Alice can create a blog post.
8473
+ users.length === 1;
8474
+ // false, because Alice is the only user present in `users`
8475
+ users[0] === bob;
8476
+ });
8477
+ ```
8478
+
8479
+ @method filter
8480
+ @for RSVP
8481
+ @param {Array} promises
8482
+ @param {Function} filterFn - function to be called on each resolved value to
8483
+ filter the final results.
8484
+ @param {String} label optional string describing the promise. Useful for
8485
+ tooling.
8486
+ @return {Promise}
8487
+ */
8488
+ function filter(promises, filterFn, label) {
8489
+ return all(promises, label).then(function(values){
8490
+ if (!isArray(promises)) {
8491
+ throw new TypeError('You must pass an array to filter.');
8492
+ }
8493
+
8494
+ if (!isFunction(filterFn)){
8495
+ throw new TypeError("You must pass a function to filter's second argument.");
8496
+ }
8497
+
8498
+ return map(promises, filterFn, label).then(function(filterResults){
8499
+ var i,
8500
+ valuesLen = values.length,
8501
+ filtered = [];
8502
+
8503
+ for (i = 0; i < valuesLen; i++){
8504
+ if(filterResults[i]) filtered.push(values[i]);
8505
+ }
8506
+ return filtered;
8507
+ });
8508
+ });
8509
+ }
8510
+
8511
+ __exports__["default"] = filter;
8585
8512
  });
8586
8513
  define("rsvp/hash",
8587
8514
  ["./promise","./utils","exports"],
8588
8515
  function(__dependency1__, __dependency2__, __exports__) {
8589
8516
  "use strict";
8590
- var Promise = __dependency1__.Promise;
8591
- var isFunction = __dependency2__.isFunction;
8592
-
8593
- var keysOf = Object.keys || function(object) {
8594
- var result = [];
8595
-
8596
- for (var prop in object) {
8597
- result.push(prop);
8598
- }
8599
-
8600
- return result;
8601
- };
8517
+ var Promise = __dependency1__["default"];
8518
+ var isNonThenable = __dependency2__.isNonThenable;
8519
+ var keysOf = __dependency2__.keysOf;
8602
8520
 
8603
8521
  /**
8604
8522
  `RSVP.hash` is similar to `RSVP.all`, but takes an object instead of an array
@@ -8632,8 +8550,9 @@ define("rsvp/hash",
8632
8550
  ````
8633
8551
 
8634
8552
  If any of the `promises` given to `RSVP.hash` are rejected, the first promise
8635
- that is rejected will be given as as the first argument, or as the reason to
8636
- the rejection handler. For example:
8553
+ that is rejected will be given as the reason to the rejection handler.
8554
+
8555
+ Example:
8637
8556
 
8638
8557
  ```javascript
8639
8558
  var promises = {
@@ -8681,52 +8600,53 @@ define("rsvp/hash",
8681
8600
  @method hash
8682
8601
  @for RSVP
8683
8602
  @param {Object} promises
8684
- @param {String} label - optional string that describes the promise.
8603
+ @param {String} label optional string that describes the promise.
8685
8604
  Useful for tooling.
8686
8605
  @return {Promise} promise that is fulfilled when all properties of `promises`
8687
8606
  have been fulfilled, or rejected if any of them become rejected.
8607
+ @static
8688
8608
  */
8689
- function hash(object, label) {
8690
- var results = {},
8691
- keys = keysOf(object),
8692
- remaining = keys.length;
8693
-
8609
+ __exports__["default"] = function hash(object, label) {
8694
8610
  return new Promise(function(resolve, reject){
8695
- var promise, prop;
8611
+ var results = {};
8612
+ var keys = keysOf(object);
8613
+ var remaining = keys.length;
8614
+ var entry, property;
8696
8615
 
8697
8616
  if (remaining === 0) {
8698
- resolve({});
8617
+ resolve(results);
8699
8618
  return;
8700
8619
  }
8701
8620
 
8702
- var resolver = function(prop) {
8621
+ function fulfilledTo(property) {
8703
8622
  return function(value) {
8704
- resolveAll(prop, value);
8623
+ results[property] = value;
8624
+ if (--remaining === 0) {
8625
+ resolve(results);
8626
+ }
8705
8627
  };
8706
- };
8707
-
8708
- var resolveAll = function(prop, value) {
8709
- results[prop] = value;
8710
- if (--remaining === 0) {
8711
- resolve(results);
8712
- }
8713
- };
8628
+ }
8714
8629
 
8630
+ function onRejection(reason) {
8631
+ remaining = 0;
8632
+ reject(reason);
8633
+ }
8715
8634
 
8716
- for (var i = 0, l = keys.length; i < l; i ++) {
8717
- prop = keys[i];
8718
- promise = object[prop];
8635
+ for (var i = 0; i < keys.length; i++) {
8636
+ property = keys[i];
8637
+ entry = object[property];
8719
8638
 
8720
- if (promise && isFunction(promise.then)) {
8721
- promise.then(resolver(prop), reject, "RSVP: RSVP#hash");
8639
+ if (isNonThenable(entry)) {
8640
+ results[property] = entry;
8641
+ if (--remaining === 0) {
8642
+ resolve(results);
8643
+ }
8722
8644
  } else {
8723
- resolveAll(prop, promise);
8645
+ Promise.cast(entry).then(fulfilledTo(property), onRejection);
8724
8646
  }
8725
8647
  }
8726
8648
  });
8727
- }
8728
-
8729
- __exports__.hash = hash;
8649
+ };
8730
8650
  });
8731
8651
  define("rsvp/instrument",
8732
8652
  ["./config","./utils","exports"],
@@ -8735,7 +8655,7 @@ define("rsvp/instrument",
8735
8655
  var config = __dependency1__.config;
8736
8656
  var now = __dependency2__.now;
8737
8657
 
8738
- function instrument(eventName, promise, child) {
8658
+ __exports__["default"] = function instrument(eventName, promise, child) {
8739
8659
  // instrumentation should not disrupt normal usage.
8740
8660
  try {
8741
8661
  config.trigger(eventName, {
@@ -8744,62 +8664,169 @@ define("rsvp/instrument",
8744
8664
  detail: promise._detail,
8745
8665
  childGuid: child && promise._guidKey + child._id,
8746
8666
  label: promise._label,
8747
- timeStamp: now()
8667
+ timeStamp: now(),
8668
+ stack: new Error(promise._label).stack
8748
8669
  });
8749
8670
  } catch(error) {
8750
8671
  setTimeout(function(){
8751
8672
  throw error;
8752
8673
  }, 0);
8753
8674
  }
8754
- }
8755
-
8756
- __exports__.instrument = instrument;
8675
+ };
8757
8676
  });
8758
- define("rsvp/node",
8759
- ["./promise","./all","exports"],
8760
- function(__dependency1__, __dependency2__, __exports__) {
8677
+ define("rsvp/map",
8678
+ ["./promise","./all","./utils","exports"],
8679
+ function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
8761
8680
  "use strict";
8762
- var Promise = __dependency1__.Promise;
8763
- var all = __dependency2__.all;
8764
-
8765
- var slice = Array.prototype.slice;
8766
-
8767
- function makeNodeCallbackFor(resolve, reject) {
8768
- return function (error, value) {
8769
- if (error) {
8770
- reject(error);
8771
- } else if (arguments.length > 2) {
8772
- resolve(slice.call(arguments, 1));
8773
- } else {
8774
- resolve(value);
8775
- }
8776
- };
8777
- }
8681
+ var Promise = __dependency1__["default"];
8682
+ var all = __dependency2__["default"];
8683
+ var isArray = __dependency3__.isArray;
8684
+ var isFunction = __dependency3__.isFunction;
8778
8685
 
8779
8686
  /**
8780
- `RSVP.denodeify` takes a "node-style" function and returns a function that
8781
- will return an `RSVP.Promise`. You can use `denodeify` in Node.js or the
8782
- browser when you'd prefer to use promises over using callbacks. For example,
8783
- `denodeify` transforms the following:
8687
+ `RSVP.map` is similar to JavaScript's native `map` method, except that it
8688
+ waits for all promises to become fulfilled before running the `mapFn` on
8689
+ each item in given to `promises`. `RSVP.map` returns a promise that will
8690
+ become fulfilled with the result of running `mapFn` on the values the promises
8691
+ become fulfilled with.
8692
+
8693
+ For example:
8784
8694
 
8785
8695
  ```javascript
8786
- var fs = require('fs');
8787
8696
 
8788
- fs.readFile('myfile.txt', function(err, data){
8789
- if (err) return handleError(err);
8790
- handleData(data);
8697
+ var promise1 = RSVP.resolve(1);
8698
+ var promise2 = RSVP.resolve(2);
8699
+ var promise3 = RSVP.resolve(3);
8700
+ var promises = [ promise1, promise2, promise3 ];
8701
+
8702
+ var mapFn = function(item){
8703
+ return item + 1;
8704
+ };
8705
+
8706
+ RSVP.map(promises, mapFn).then(function(result){
8707
+ // result is [ 2, 3, 4 ]
8791
8708
  });
8792
8709
  ```
8793
8710
 
8794
- into:
8711
+ If any of the `promises` given to `RSVP.map` are rejected, the first promise
8712
+ that is rejected will be given as an argument to the returned promise's
8713
+ rejection handler. For example:
8795
8714
 
8796
8715
  ```javascript
8797
- var fs = require('fs');
8798
-
8799
- var readFile = RSVP.denodeify(fs.readFile);
8716
+ var promise1 = RSVP.resolve(1);
8717
+ var promise2 = RSVP.reject(new Error("2"));
8718
+ var promise3 = RSVP.reject(new Error("3"));
8719
+ var promises = [ promise1, promise2, promise3 ];
8800
8720
 
8801
- readFile('myfile.txt').then(handleData, handleError);
8802
- ```
8721
+ var mapFn = function(item){
8722
+ return item + 1;
8723
+ };
8724
+
8725
+ RSVP.map(promises, mapFn).then(function(array){
8726
+ // Code here never runs because there are rejected promises!
8727
+ }, function(reason) {
8728
+ // reason.message === "2"
8729
+ });
8730
+ ```
8731
+
8732
+ `RSVP.map` will also wait if a promise is returned from `mapFn`. For example,
8733
+ say you want to get all comments from a set of blog posts, but you need
8734
+ the blog posts first becuase they contain a url to those comments.
8735
+
8736
+ ```javscript
8737
+
8738
+ var mapFn = function(blogPost){
8739
+ // getComments does some ajax and returns an RSVP.Promise that is fulfilled
8740
+ // with some comments data
8741
+ return getComments(blogPost.comments_url);
8742
+ };
8743
+
8744
+ // getBlogPosts does some ajax and returns an RSVP.Promise that is fulfilled
8745
+ // with some blog post data
8746
+ RSVP.map(getBlogPosts(), mapFn).then(function(comments){
8747
+ // comments is the result of asking the server for the comments
8748
+ // of all blog posts returned from getBlogPosts()
8749
+ });
8750
+ ```
8751
+
8752
+ @method map
8753
+ @for RSVP
8754
+ @param {Array} promises
8755
+ @param {Function} mapFn function to be called on each fulfilled promise.
8756
+ @param {String} label optional string for labeling the promise.
8757
+ Useful for tooling.
8758
+ @return {Promise} promise that is fulfilled with the result of calling
8759
+ `mapFn` on each fulfilled promise or value when they become fulfilled.
8760
+ The promise will be rejected if any of the given `promises` become rejected.
8761
+ @static
8762
+ */
8763
+ __exports__["default"] = function map(promises, mapFn, label) {
8764
+ return all(promises, label).then(function(results){
8765
+ if (!isArray(promises)) {
8766
+ throw new TypeError('You must pass an array to map.');
8767
+ }
8768
+
8769
+ if (!isFunction(mapFn)){
8770
+ throw new TypeError("You must pass a function to map's second argument.");
8771
+ }
8772
+
8773
+
8774
+ var resultLen = results.length,
8775
+ mappedResults = [],
8776
+ i;
8777
+
8778
+ for (i = 0; i < resultLen; i++){
8779
+ mappedResults.push(mapFn(results[i]));
8780
+ }
8781
+
8782
+ return all(mappedResults, label);
8783
+ });
8784
+ };
8785
+ });
8786
+ define("rsvp/node",
8787
+ ["./promise","exports"],
8788
+ function(__dependency1__, __exports__) {
8789
+ "use strict";
8790
+ var Promise = __dependency1__["default"];
8791
+
8792
+ var slice = Array.prototype.slice;
8793
+
8794
+ function makeNodeCallbackFor(resolve, reject) {
8795
+ return function (error, value) {
8796
+ if (error) {
8797
+ reject(error);
8798
+ } else if (arguments.length > 2) {
8799
+ resolve(slice.call(arguments, 1));
8800
+ } else {
8801
+ resolve(value);
8802
+ }
8803
+ };
8804
+ }
8805
+
8806
+ /**
8807
+ `RSVP.denodeify` takes a "node-style" function and returns a function that
8808
+ will return an `RSVP.Promise`. You can use `denodeify` in Node.js or the
8809
+ browser when you'd prefer to use promises over using callbacks. For example,
8810
+ `denodeify` transforms the following:
8811
+
8812
+ ```javascript
8813
+ var fs = require('fs');
8814
+
8815
+ fs.readFile('myfile.txt', function(err, data){
8816
+ if (err) return handleError(err);
8817
+ handleData(data);
8818
+ });
8819
+ ```
8820
+
8821
+ into:
8822
+
8823
+ ```javascript
8824
+ var fs = require('fs');
8825
+
8826
+ var readFile = RSVP.denodeify(fs.readFile);
8827
+
8828
+ readFile('myfile.txt').then(handleData, handleError);
8829
+ ```
8803
8830
 
8804
8831
  Using `denodeify` makes it easier to compose asynchronous operations instead
8805
8832
  of using callbacks. For example, instead of:
@@ -8849,14 +8876,15 @@ define("rsvp/node",
8849
8876
  calling the `nodeFunc` function.
8850
8877
  @return {Function} a function that wraps `nodeFunc` to return an
8851
8878
  `RSVP.Promise`
8879
+ @static
8852
8880
  */
8853
- function denodeify(nodeFunc, binding) {
8881
+ __exports__["default"] = function denodeify(nodeFunc, binding) {
8854
8882
  return function() {
8855
8883
  var nodeArgs = slice.call(arguments), resolve, reject;
8856
8884
  var thisArg = this || binding;
8857
8885
 
8858
8886
  return new Promise(function(resolve, reject) {
8859
- all(nodeArgs).then(function(nodeArgs) {
8887
+ Promise.all(nodeArgs).then(function(nodeArgs) {
8860
8888
  try {
8861
8889
  nodeArgs.push(makeNodeCallbackFor(resolve, reject));
8862
8890
  nodeFunc.apply(thisArg, nodeArgs);
@@ -8866,25 +8894,137 @@ define("rsvp/node",
8866
8894
  });
8867
8895
  });
8868
8896
  };
8869
- }
8870
-
8871
- __exports__.denodeify = denodeify;
8897
+ };
8872
8898
  });
8873
8899
  define("rsvp/promise",
8874
- ["./config","./events","./cast","./instrument","./utils","exports"],
8875
- function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {
8900
+ ["./config","./events","./instrument","./utils","./promise/cast","./promise/all","./promise/race","./promise/resolve","./promise/reject","exports"],
8901
+ function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __exports__) {
8876
8902
  "use strict";
8877
8903
  var config = __dependency1__.config;
8878
- var EventTarget = __dependency2__.EventTarget;
8879
- var cast = __dependency3__.cast;
8880
- var instrument = __dependency4__.instrument;
8881
- var objectOrFunction = __dependency5__.objectOrFunction;
8882
- var isFunction = __dependency5__.isFunction;
8883
- var now = __dependency5__.now;
8904
+ var EventTarget = __dependency2__["default"];
8905
+ var instrument = __dependency3__["default"];
8906
+ var objectOrFunction = __dependency4__.objectOrFunction;
8907
+ var isFunction = __dependency4__.isFunction;
8908
+ var now = __dependency4__.now;
8909
+ var cast = __dependency5__["default"];
8910
+ var all = __dependency6__["default"];
8911
+ var race = __dependency7__["default"];
8912
+ var Resolve = __dependency8__["default"];
8913
+ var Reject = __dependency9__["default"];
8884
8914
 
8885
8915
  var guidKey = 'rsvp_' + now() + '-';
8886
8916
  var counter = 0;
8887
8917
 
8918
+ function noop() {}
8919
+
8920
+ __exports__["default"] = Promise;
8921
+
8922
+
8923
+ /**
8924
+ Promise objects represent the eventual result of an asynchronous operation. The
8925
+ primary way of interacting with a promise is through its `then` method, which
8926
+ registers callbacks to receive either a promise’s eventual value or the reason
8927
+ why the promise cannot be fulfilled.
8928
+
8929
+ Terminology
8930
+ -----------
8931
+
8932
+ - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
8933
+ - `thenable` is an object or function that defines a `then` method.
8934
+ - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
8935
+ - `exception` is a value that is thrown using the throw statement.
8936
+ - `reason` is a value that indicates why a promise was rejected.
8937
+ - `settled` the final resting state of a promise, fulfilled or rejected.
8938
+
8939
+ A promise can be in one of three states: pending, fulfilled, or rejected.
8940
+
8941
+ Promises that are fulfilled have a fulfillment value and are in the fulfilled
8942
+ state. Promises that are rejected have a rejection reason and are in the
8943
+ rejected state. A fulfillment value is never a thenable. Similarly, a
8944
+ rejection reason is never a thenable.
8945
+
8946
+ Promises can also be said to *resolve* a value. If this value is also a
8947
+ promise, then the original promise's settled state will match the value's
8948
+ settled state. So a promise that *resolves* a promise that rejects will
8949
+ itself reject, and a promise that *resolves* a promise that fulfills will
8950
+ itself fulfill.
8951
+
8952
+
8953
+ Basic Usage:
8954
+ ------------
8955
+
8956
+ ```js
8957
+ var promise = new Promise(function(resolve, reject) {
8958
+ // on success
8959
+ resolve(value);
8960
+
8961
+ // on failure
8962
+ reject(reason);
8963
+ });
8964
+
8965
+ promise.then(function(value) {
8966
+ // on fulfillment
8967
+ }, function(reason) {
8968
+ // on rejection
8969
+ });
8970
+ ```
8971
+
8972
+ Advanced Usage:
8973
+ ---------------
8974
+
8975
+ Promises shine when abstracting away asynchronous interactions such as
8976
+ `XMLHttpRequest`s.
8977
+
8978
+ ```js
8979
+ function getJSON(url) {
8980
+ return new Promise(function(resolve, reject){
8981
+ var xhr = new XMLHttpRequest();
8982
+
8983
+ xhr.open('GET', url);
8984
+ xhr.onreadystatechange = handler;
8985
+ xhr.responseType = 'json';
8986
+ xhr.setRequestHeader('Accept', 'application/json');
8987
+ xhr.send();
8988
+
8989
+ function handler() {
8990
+ if (this.readyState === this.DONE) {
8991
+ if (this.status === 200) {
8992
+ resolve(this.response);
8993
+ } else {
8994
+ reject(new Error("getJSON: `" + url + "` failed with status: [" + this.status + "]");
8995
+ }
8996
+ }
8997
+ };
8998
+ });
8999
+ }
9000
+
9001
+ getJSON('/posts.json').then(function(json) {
9002
+ // on fulfillment
9003
+ }, function(reason) {
9004
+ // on rejection
9005
+ });
9006
+ ```
9007
+
9008
+ Unlike callbacks, promises are great composable primitives.
9009
+
9010
+ ```js
9011
+ Promise.all([
9012
+ getJSON('/posts'),
9013
+ getJSON('/comments')
9014
+ ]).then(function(values){
9015
+ values[0] // => postsJSON
9016
+ values[1] // => commentsJSON
9017
+
9018
+ return values;
9019
+ });
9020
+ ```
9021
+
9022
+ @class RSVP.Promise
9023
+ @param {function}
9024
+ @param {String} label optional string for labeling the promise.
9025
+ Useful for tooling.
9026
+ @constructor
9027
+ */
8888
9028
  function Promise(resolver, label) {
8889
9029
  if (!isFunction(resolver)) {
8890
9030
  throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
@@ -8902,7 +9042,9 @@ define("rsvp/promise",
8902
9042
  instrument('created', this);
8903
9043
  }
8904
9044
 
8905
- invokeResolver(resolver, this);
9045
+ if (noop !== resolver) {
9046
+ invokeResolver(resolver, this);
9047
+ }
8906
9048
  }
8907
9049
 
8908
9050
  function invokeResolver(resolver, promise) {
@@ -8921,35 +9063,11 @@ define("rsvp/promise",
8921
9063
  }
8922
9064
  }
8923
9065
 
8924
- function invokeCallback(settled, promise, callback, detail) {
8925
- var hasCallback = isFunction(callback),
8926
- value, error, succeeded, failed;
8927
-
8928
- if (hasCallback) {
8929
- try {
8930
- value = callback(detail);
8931
- succeeded = true;
8932
- } catch(e) {
8933
- failed = true;
8934
- error = e;
8935
- }
8936
- } else {
8937
- value = detail;
8938
- succeeded = true;
8939
- }
8940
-
8941
- if (handleThenable(promise, value)) {
8942
- return;
8943
- } else if (hasCallback && succeeded) {
8944
- resolve(promise, value);
8945
- } else if (failed) {
8946
- reject(promise, error);
8947
- } else if (settled === FULFILLED) {
8948
- resolve(promise, value);
8949
- } else if (settled === REJECTED) {
8950
- reject(promise, value);
8951
- }
8952
- }
9066
+ Promise.cast = cast;
9067
+ Promise.all = all;
9068
+ Promise.race = race;
9069
+ Promise.resolve = Resolve;
9070
+ Promise.reject = Reject;
8953
9071
 
8954
9072
  var PENDING = void 0;
8955
9073
  var SEALED = 0;
@@ -8997,11 +9115,205 @@ define("rsvp/promise",
8997
9115
  config.trigger('error', reason);
8998
9116
  },
8999
9117
 
9118
+ /**
9119
+ The primary way of interacting with a promise is through its `then` method,
9120
+ which registers callbacks to receive either a promise's eventual value or the
9121
+ reason why the promise cannot be fulfilled.
9122
+
9123
+ ```js
9124
+ findUser().then(function(user){
9125
+ // user is available
9126
+ }, function(reason){
9127
+ // user is unavailable, and you are given the reason why
9128
+ });
9129
+ ```
9130
+
9131
+ Chaining
9132
+ --------
9133
+
9134
+ The return value of `then` is itself a promise. This second, "downstream"
9135
+ promise is resolved with the return value of the first promise's fulfillment
9136
+ or rejection handler, or rejected if the handler throws an exception.
9137
+
9138
+ ```js
9139
+ findUser().then(function (user) {
9140
+ return user.name;
9141
+ }, function (reason) {
9142
+ return "default name";
9143
+ }).then(function (userName) {
9144
+ // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
9145
+ // will be `"default name"`
9146
+ });
9147
+
9148
+ findUser().then(function (user) {
9149
+ throw new Error("Found user, but still unhappy");
9150
+ }, function (reason) {
9151
+ throw new Error("`findUser` rejected and we're unhappy");
9152
+ }).then(function (value) {
9153
+ // never reached
9154
+ }, function (reason) {
9155
+ // if `findUser` fulfilled, `reason` will be "Found user, but still unhappy".
9156
+ // If `findUser` rejected, `reason` will be "`findUser` rejected and we're unhappy".
9157
+ });
9158
+ ```
9159
+ If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
9160
+
9161
+ ```js
9162
+ findUser().then(function (user) {
9163
+ throw new PedagogicalException("Upstream error");
9164
+ }).then(function (value) {
9165
+ // never reached
9166
+ }).then(function (value) {
9167
+ // never reached
9168
+ }, function (reason) {
9169
+ // The `PedgagocialException` is propagated all the way down to here
9170
+ });
9171
+ ```
9172
+
9173
+ Assimilation
9174
+ ------------
9175
+
9176
+ Sometimes the value you want to propagate to a downstream promise can only be
9177
+ retrieved asynchronously. This can be achieved by returning a promise in the
9178
+ fulfillment or rejection handler. The downstream promise will then be pending
9179
+ until the returned promise is settled. This is called *assimilation*.
9180
+
9181
+ ```js
9182
+ findUser().then(function (user) {
9183
+ return findCommentsByAuthor(user);
9184
+ }).then(function (comments) {
9185
+ // The user's comments are now available
9186
+ });
9187
+ ```
9188
+
9189
+ If the assimliated promise rejects, then the downstream promise will also reject.
9190
+
9191
+ ```js
9192
+ findUser().then(function (user) {
9193
+ return findCommentsByAuthor(user);
9194
+ }).then(function (comments) {
9195
+ // If `findCommentsByAuthor` fulfills, we'll have the value here
9196
+ }, function (reason) {
9197
+ // If `findCommentsByAuthor` rejects, we'll have the reason here
9198
+ });
9199
+ ```
9200
+
9201
+ Simple Example
9202
+ --------------
9203
+
9204
+ Synchronous Example
9205
+
9206
+ ```javascript
9207
+ var result;
9208
+
9209
+ try {
9210
+ result = findResult();
9211
+ // success
9212
+ } catch(reason) {
9213
+ // failure
9214
+ }
9215
+ ```
9216
+
9217
+ Errback Example
9218
+
9219
+ ```js
9220
+ findResult(function(result, err){
9221
+ if (err) {
9222
+ // failure
9223
+ } else {
9224
+ // success
9225
+ }
9226
+ });
9227
+ ```
9228
+
9229
+ Promise Example;
9230
+
9231
+ ```javascript
9232
+ findResult().then(function(result){
9233
+ // success
9234
+ }, function(reason){
9235
+ // failure
9236
+ });
9237
+ ```
9238
+
9239
+ Advanced Example
9240
+ --------------
9241
+
9242
+ Synchronous Example
9243
+
9244
+ ```javascript
9245
+ var author, books;
9246
+
9247
+ try {
9248
+ author = findAuthor();
9249
+ books = findBooksByAuthor(author);
9250
+ // success
9251
+ } catch(reason) {
9252
+ // failure
9253
+ }
9254
+ ```
9255
+
9256
+ Errback Example
9257
+
9258
+ ```js
9259
+
9260
+ function foundBooks(books) {
9261
+
9262
+ }
9263
+
9264
+ function failure(reason) {
9265
+
9266
+ }
9267
+
9268
+ findAuthor(function(author, err){
9269
+ if (err) {
9270
+ failure(err);
9271
+ // failure
9272
+ } else {
9273
+ try {
9274
+ findBoooksByAuthor(author, function(books, err) {
9275
+ if (err) {
9276
+ failure(err);
9277
+ } else {
9278
+ try {
9279
+ foundBooks(books);
9280
+ } catch(reason) {
9281
+ failure(reason);
9282
+ }
9283
+ }
9284
+ });
9285
+ } catch(error) {
9286
+ failure(err);
9287
+ }
9288
+ // success
9289
+ }
9290
+ });
9291
+ ```
9292
+
9293
+ Promise Example;
9294
+
9295
+ ```javascript
9296
+ findAuthor().
9297
+ then(findBooksByAuthor).
9298
+ then(function(books){
9299
+ // found books
9300
+ }).catch(function(reason){
9301
+ // something went wrong
9302
+ });
9303
+ ```
9304
+
9305
+ @method then
9306
+ @param {Function} onFulfilled
9307
+ @param {Function} onRejected
9308
+ @param {String} label optional string for labeling the promise.
9309
+ Useful for tooling.
9310
+ @return {Promise}
9311
+ */
9000
9312
  then: function(onFulfillment, onRejection, label) {
9001
9313
  var promise = this;
9002
9314
  this._onerror = null;
9003
9315
 
9004
- var thenPromise = new this.constructor(function() {}, label);
9316
+ var thenPromise = new this.constructor(noop, label);
9005
9317
 
9006
9318
  if (this._state) {
9007
9319
  var callbacks = arguments;
@@ -9019,118 +9331,398 @@ define("rsvp/promise",
9019
9331
  return thenPromise;
9020
9332
  },
9021
9333
 
9334
+ /**
9335
+ `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
9336
+ as the catch block of a try/catch statement.
9337
+
9338
+ ```js
9339
+ function findAuthor(){
9340
+ throw new Error("couldn't find that author");
9341
+ }
9342
+
9343
+ // synchronous
9344
+ try {
9345
+ findAuthor();
9346
+ } catch(reason) {
9347
+ // something went wrong
9348
+ }
9349
+
9350
+ // async with promises
9351
+ findAuthor().catch(function(reason){
9352
+ // something went wrong
9353
+ });
9354
+ ```
9355
+
9356
+ @method catch
9357
+ @param {Function} onRejection
9358
+ @param {String} label optional string for labeling the promise.
9359
+ Useful for tooling.
9360
+ @return {Promise}
9361
+ */
9022
9362
  'catch': function(onRejection, label) {
9023
9363
  return this.then(null, onRejection, label);
9024
9364
  },
9025
9365
 
9026
- 'finally': function(callback, label) {
9027
- var constructor = this.constructor;
9366
+ /**
9367
+ `finally` will be invoked regardless of the promise's fate just as native
9368
+ try/catch/finally behaves
9369
+
9370
+ Synchronous example:
9371
+
9372
+ ```js
9373
+ findAuthor() {
9374
+ if (Math.random() > 0.5) {
9375
+ throw new Error();
9376
+ }
9377
+ return new Author();
9378
+ }
9379
+
9380
+ try {
9381
+ return findAuthor(); // succeed or fail
9382
+ } catch(error) {
9383
+ return findOtherAuther();
9384
+ } finally {
9385
+ // always runs
9386
+ // doesn't affect the return value
9387
+ }
9388
+ ```
9389
+
9390
+ Asynchronous example:
9391
+
9392
+ ```js
9393
+ findAuthor().catch(function(reason){
9394
+ return findOtherAuther();
9395
+ }).finally(function(){
9396
+ // author was either found, or not
9397
+ });
9398
+ ```
9399
+
9400
+ @method finally
9401
+ @param {Function} callback
9402
+ @param {String} label optional string for labeling the promise.
9403
+ Useful for tooling.
9404
+ @return {Promise}
9405
+ */
9406
+ 'finally': function(callback, label) {
9407
+ var constructor = this.constructor;
9408
+
9409
+ return this.then(function(value) {
9410
+ return constructor.cast(callback()).then(function(){
9411
+ return value;
9412
+ });
9413
+ }, function(reason) {
9414
+ return constructor.cast(callback()).then(function(){
9415
+ throw reason;
9416
+ });
9417
+ }, label);
9418
+ }
9419
+ };
9420
+
9421
+ function invokeCallback(settled, promise, callback, detail) {
9422
+ var hasCallback = isFunction(callback),
9423
+ value, error, succeeded, failed;
9424
+
9425
+ if (hasCallback) {
9426
+ try {
9427
+ value = callback(detail);
9428
+ succeeded = true;
9429
+ } catch(e) {
9430
+ failed = true;
9431
+ error = e;
9432
+ }
9433
+ } else {
9434
+ value = detail;
9435
+ succeeded = true;
9436
+ }
9437
+
9438
+ if (handleThenable(promise, value)) {
9439
+ return;
9440
+ } else if (hasCallback && succeeded) {
9441
+ resolve(promise, value);
9442
+ } else if (failed) {
9443
+ reject(promise, error);
9444
+ } else if (settled === FULFILLED) {
9445
+ resolve(promise, value);
9446
+ } else if (settled === REJECTED) {
9447
+ reject(promise, value);
9448
+ }
9449
+ }
9450
+
9451
+ function handleThenable(promise, value) {
9452
+ var then = null,
9453
+ resolved;
9454
+
9455
+ try {
9456
+ if (promise === value) {
9457
+ throw new TypeError("A promises callback cannot return that same promise.");
9458
+ }
9459
+
9460
+ if (objectOrFunction(value)) {
9461
+ then = value.then;
9462
+
9463
+ if (isFunction(then)) {
9464
+ then.call(value, function(val) {
9465
+ if (resolved) { return true; }
9466
+ resolved = true;
9467
+
9468
+ if (value !== val) {
9469
+ resolve(promise, val);
9470
+ } else {
9471
+ fulfill(promise, val);
9472
+ }
9473
+ }, function(val) {
9474
+ if (resolved) { return true; }
9475
+ resolved = true;
9476
+
9477
+ reject(promise, val);
9478
+ }, 'derived from: ' + (promise._label || ' unknown promise'));
9479
+
9480
+ return true;
9481
+ }
9482
+ }
9483
+ } catch (error) {
9484
+ if (resolved) { return true; }
9485
+ reject(promise, error);
9486
+ return true;
9487
+ }
9488
+
9489
+ return false;
9490
+ }
9491
+
9492
+ function resolve(promise, value) {
9493
+ if (promise === value) {
9494
+ fulfill(promise, value);
9495
+ } else if (!handleThenable(promise, value)) {
9496
+ fulfill(promise, value);
9497
+ }
9498
+ }
9499
+
9500
+ function fulfill(promise, value) {
9501
+ if (promise._state !== PENDING) { return; }
9502
+ promise._state = SEALED;
9503
+ promise._detail = value;
9504
+
9505
+ config.async(publishFulfillment, promise);
9506
+ }
9507
+
9508
+ function reject(promise, reason) {
9509
+ if (promise._state !== PENDING) { return; }
9510
+ promise._state = SEALED;
9511
+ promise._detail = reason;
9512
+
9513
+ config.async(publishRejection, promise);
9514
+ }
9515
+
9516
+ function publishFulfillment(promise) {
9517
+ publish(promise, promise._state = FULFILLED);
9518
+ }
9519
+
9520
+ function publishRejection(promise) {
9521
+ if (promise._onerror) {
9522
+ promise._onerror(promise._detail);
9523
+ }
9524
+
9525
+ publish(promise, promise._state = REJECTED);
9526
+ }
9527
+ });
9528
+ define("rsvp/promise/all",
9529
+ ["../utils","exports"],
9530
+ function(__dependency1__, __exports__) {
9531
+ "use strict";
9532
+ var isArray = __dependency1__.isArray;
9533
+ var isNonThenable = __dependency1__.isNonThenable;
9534
+
9535
+ /**
9536
+ `RSVP.Promise.all` accepts an array of promises, and returns a new promise which
9537
+ is fulfilled with an array of fulfillment values for the passed promises, or
9538
+ rejected with the reason of the first passed promise to be rejected. It casts all
9539
+ elements of the passed iterable to promises as it runs this algorithm.
9540
+
9541
+ Example:
9542
+
9543
+ ```javascript
9544
+ var promise1 = RSVP.resolve(1);
9545
+ var promise2 = RSVP.resolve(2);
9546
+ var promise3 = RSVP.resolve(3);
9547
+ var promises = [ promise1, promise2, promise3 ];
9548
+
9549
+ RSVP.Promise.all(promises).then(function(array){
9550
+ // The array here would be [ 1, 2, 3 ];
9551
+ });
9552
+ ```
9553
+
9554
+ If any of the `promises` given to `RSVP.all` are rejected, the first promise
9555
+ that is rejected will be given as an argument to the returned promises's
9556
+ rejection handler. For example:
9557
+
9558
+ Example:
9559
+
9560
+ ```javascript
9561
+ var promise1 = RSVP.resolve(1);
9562
+ var promise2 = RSVP.reject(new Error("2"));
9563
+ var promise3 = RSVP.reject(new Error("3"));
9564
+ var promises = [ promise1, promise2, promise3 ];
9565
+
9566
+ RSVP.Promise.all(promises).then(function(array){
9567
+ // Code here never runs because there are rejected promises!
9568
+ }, function(error) {
9569
+ // error.message === "2"
9570
+ });
9571
+ ```
9572
+
9573
+ @method all
9574
+ @for RSVP.Promise
9575
+ @param {Array} entries array of promises
9576
+ @param {String} label optional string for labeling the promise.
9577
+ Useful for tooling.
9578
+ @return {Promise} promise that is fulfilled when all `promises` have been
9579
+ fulfilled, or rejected if any of them become rejected.
9580
+ @static
9581
+ */
9582
+ __exports__["default"] = function all(entries, label) {
9583
+
9584
+ /*jshint validthis:true */
9585
+ var Constructor = this;
9586
+
9587
+ return new Constructor(function(resolve, reject) {
9588
+ if (!isArray(entries)) {
9589
+ throw new TypeError('You must pass an array to all.');
9590
+ }
9591
+
9592
+ var remaining = entries.length;
9593
+ var results = new Array(remaining);
9594
+ var entry, pending = true;
9595
+
9596
+ if (remaining === 0) {
9597
+ resolve(results);
9598
+ return;
9599
+ }
9600
+
9601
+ function fulfillmentAt(index) {
9602
+ return function(value) {
9603
+ results[index] = value;
9604
+ if (--remaining === 0) {
9605
+ resolve(results);
9606
+ }
9607
+ };
9608
+ }
9609
+
9610
+ function onRejection(reason) {
9611
+ remaining = 0;
9612
+ reject(reason);
9613
+ }
9614
+
9615
+ for (var index = 0; index < entries.length; index++) {
9616
+ entry = entries[index];
9617
+ if (isNonThenable(entry)) {
9618
+ results[index] = entry;
9619
+ if (--remaining === 0) {
9620
+ resolve(results);
9621
+ }
9622
+ } else {
9623
+ Constructor.cast(entry).then(fulfillmentAt(index), onRejection);
9624
+ }
9625
+ }
9626
+ }, label);
9627
+ };
9628
+ });
9629
+ define("rsvp/promise/cast",
9630
+ ["exports"],
9631
+ function(__exports__) {
9632
+ "use strict";
9633
+ /**
9634
+ `RSVP.Promise.cast` coerces its argument to a promise, or returns the
9635
+ argument if it is already a promise which shares a constructor with the caster.
9636
+
9637
+ Example:
9028
9638
 
9029
- return this.then(function(value) {
9030
- return constructor.cast(callback()).then(function(){
9031
- return value;
9032
- });
9033
- }, function(reason) {
9034
- return constructor.cast(callback()).then(function(){
9035
- throw reason;
9036
- });
9037
- }, label);
9038
- }
9039
- };
9639
+ ```javascript
9640
+ var promise = RSVP.Promise.resolve(1);
9641
+ var casted = RSVP.Promise.cast(promise);
9040
9642
 
9041
- Promise.cast = cast;
9643
+ console.log(promise === casted); // true
9644
+ ```
9042
9645
 
9043
- function handleThenable(promise, value) {
9044
- var then = null,
9045
- resolved;
9646
+ In the case of a promise whose constructor does not match, it is assimilated.
9647
+ The resulting promise will fulfill or reject based on the outcome of the
9648
+ promise being casted.
9046
9649
 
9047
- try {
9048
- if (promise === value) {
9049
- throw new TypeError("A promises callback cannot return that same promise.");
9050
- }
9650
+ Example:
9051
9651
 
9052
- if (objectOrFunction(value)) {
9053
- then = value.then;
9652
+ ```javascript
9653
+ var thennable = $.getJSON('/api/foo');
9654
+ var casted = RSVP.Promise.cast(thennable);
9054
9655
 
9055
- if (isFunction(then)) {
9056
- then.call(value, function(val) {
9057
- if (resolved) { return true; }
9058
- resolved = true;
9656
+ console.log(thennable === casted); // false
9657
+ console.log(casted instanceof RSVP.Promise) // true
9059
9658
 
9060
- if (value !== val) {
9061
- resolve(promise, val);
9062
- } else {
9063
- fulfill(promise, val);
9064
- }
9065
- }, function(val) {
9066
- if (resolved) { return true; }
9067
- resolved = true;
9659
+ casted.then(function(data) {
9660
+ // data is the value getJSON fulfills with
9661
+ });
9662
+ ```
9068
9663
 
9069
- reject(promise, val);
9070
- }, 'Locked onto ' + (promise._label || ' unknown promise'));
9664
+ In the case of a non-promise, a promise which will fulfill with that value is
9665
+ returned.
9071
9666
 
9072
- return true;
9073
- }
9074
- }
9075
- } catch (error) {
9076
- if (resolved) { return true; }
9077
- reject(promise, error);
9078
- return true;
9079
- }
9667
+ Example:
9080
9668
 
9081
- return false;
9082
- }
9669
+ ```javascript
9670
+ var value = 1; // could be a number, boolean, string, undefined...
9671
+ var casted = RSVP.Promise.cast(value);
9083
9672
 
9084
- function resolve(promise, value) {
9085
- if (promise === value) {
9086
- fulfill(promise, value);
9087
- } else if (!handleThenable(promise, value)) {
9088
- fulfill(promise, value);
9089
- }
9090
- }
9673
+ console.log(value === casted); // false
9674
+ console.log(casted instanceof RSVP.Promise) // true
9091
9675
 
9092
- function fulfill(promise, value) {
9093
- if (promise._state !== PENDING) { return; }
9094
- promise._state = SEALED;
9095
- promise._detail = value;
9676
+ casted.then(function(val) {
9677
+ val === value // => true
9678
+ });
9679
+ ```
9096
9680
 
9097
- config.async(publishFulfillment, promise);
9098
- }
9681
+ `RSVP.Promise.cast` is similar to `RSVP.Promise.resolve`, but `RSVP.Promise.cast` differs in the
9682
+ following ways:
9099
9683
 
9100
- function reject(promise, reason) {
9101
- if (promise._state !== PENDING) { return; }
9102
- promise._state = SEALED;
9103
- promise._detail = reason;
9684
+ * `RSVP.Promise.cast` serves as a memory-efficient way of getting a promise, when you
9685
+ have something that could either be a promise or a value. RSVP.resolve
9686
+ will have the same effect but will create a new promise wrapper if the
9687
+ argument is a promise.
9688
+ * `RSVP.Promise.cast` is a way of casting incoming thenables or promise subclasses to
9689
+ promises of the exact class specified, so that the resulting object's `then` is
9690
+ ensured to have the behavior of the constructor you are calling cast on (i.e., RSVP.Promise).
9104
9691
 
9105
- config.async(publishRejection, promise);
9106
- }
9692
+ @method cast
9693
+ @param {Object} object to be casted
9694
+ @param {String} label optional string for labeling the promise.
9695
+ Useful for tooling.
9696
+ @return {Promise} promise
9697
+ @static
9698
+ */
9107
9699
 
9108
- function publishFulfillment(promise) {
9109
- publish(promise, promise._state = FULFILLED);
9110
- }
9700
+ __exports__["default"] = function cast(object, label) {
9701
+ /*jshint validthis:true */
9702
+ var Constructor = this;
9111
9703
 
9112
- function publishRejection(promise) {
9113
- if (promise._onerror) {
9114
- promise._onerror(promise._detail);
9704
+ if (object && typeof object === 'object' && object.constructor === Constructor) {
9705
+ return object;
9115
9706
  }
9116
9707
 
9117
- publish(promise, promise._state = REJECTED);
9118
- }
9119
-
9120
- __exports__.Promise = Promise;
9708
+ return new Constructor(function(resolve) {
9709
+ resolve(object);
9710
+ }, label);
9711
+ };
9121
9712
  });
9122
- define("rsvp/race",
9123
- ["./promise","./utils","exports"],
9124
- function(__dependency1__, __dependency2__, __exports__) {
9713
+ define("rsvp/promise/race",
9714
+ ["../utils","exports"],
9715
+ function(__dependency1__, __exports__) {
9125
9716
  "use strict";
9126
9717
  /* global toString */
9127
9718
 
9128
- var Promise = __dependency1__.Promise;
9129
- var isArray = __dependency2__.isArray;
9719
+ var isArray = __dependency1__.isArray;
9720
+ var isFunction = __dependency1__.isFunction;
9721
+ var isNonThenable = __dependency1__.isNonThenable;
9130
9722
 
9131
9723
  /**
9132
- `RSVP.race` allows you to watch a series of promises and act as soon as the
9133
- first promise given to the `promises` argument fulfills or rejects.
9724
+ `RSVP.Promise.race` returns a new promise which is settled in the same way as the
9725
+ first passed promise to settle.
9134
9726
 
9135
9727
  Example:
9136
9728
 
@@ -9147,17 +9739,17 @@ define("rsvp/race",
9147
9739
  }, 100);
9148
9740
  });
9149
9741
 
9150
- RSVP.race([promise1, promise2]).then(function(result){
9742
+ RSVP.Promise.race([promise1, promise2]).then(function(result){
9151
9743
  // result === "promise 2" because it was resolved before promise1
9152
9744
  // was resolved.
9153
9745
  });
9154
9746
  ```
9155
9747
 
9156
- `RSVP.race` is deterministic in that only the state of the first completed
9157
- promise matters. For example, even if other promises given to the `promises`
9158
- array argument are resolved, but the first completed promise has become
9159
- rejected before the other promises became fulfilled, the returned promise
9160
- will become rejected:
9748
+ `RSVP.Promise.race` is deterministic in that only the state of the first
9749
+ settled promise matters. For example, even if other promises given to the
9750
+ `promises` array argument are resolved, but the first settled promise has
9751
+ become rejected before the other promises became fulfilled, the returned
9752
+ promise will become rejected:
9161
9753
 
9162
9754
  ```javascript
9163
9755
  var promise1 = new RSVP.Promise(function(resolve, reject){
@@ -9172,54 +9764,62 @@ define("rsvp/race",
9172
9764
  }, 100);
9173
9765
  });
9174
9766
 
9175
- RSVP.race([promise1, promise2]).then(function(result){
9176
- // Code here never runs because there are rejected promises!
9767
+ RSVP.Promise.race([promise1, promise2]).then(function(result){
9768
+ // Code here never runs
9177
9769
  }, function(reason){
9178
9770
  // reason.message === "promise2" because promise 2 became rejected before
9179
9771
  // promise 1 became fulfilled
9180
9772
  });
9181
9773
  ```
9182
9774
 
9775
+ An example real-world use case is implementing timeouts:
9776
+
9777
+ ```javascript
9778
+ RSVP.Promise.race([ajax('foo.json'), timeout(5000)])
9779
+ ```
9780
+
9183
9781
  @method race
9184
- @for RSVP
9185
9782
  @param {Array} promises array of promises to observe
9186
9783
  @param {String} label optional string for describing the promise returned.
9187
9784
  Useful for tooling.
9188
- @return {Promise} a promise that becomes fulfilled with the value the first
9189
- completed promises is resolved with if the first completed promise was
9190
- fulfilled, or rejected with the reason that the first completed promise
9191
- was rejected with.
9785
+ @return {Promise} a promise which settles in the same way as the first passed
9786
+ promise to settle.
9787
+ @static
9192
9788
  */
9193
- function race(promises, label) {
9194
- if (!isArray(promises)) {
9195
- throw new TypeError('You must pass an array to race.');
9196
- }
9197
- return new Promise(function(resolve, reject) {
9198
- var results = [], promise;
9789
+ __exports__["default"] = function race(entries, label) {
9790
+ /*jshint validthis:true */
9791
+ var Constructor = this, entry;
9792
+
9793
+ return new Constructor(function(resolve, reject) {
9794
+ if (!isArray(entries)) {
9795
+ throw new TypeError('You must pass an array to race.');
9796
+ }
9797
+
9798
+ var pending = true;
9199
9799
 
9200
- for (var i = 0; i < promises.length; i++) {
9201
- promise = promises[i];
9800
+ function onFulfillment(value) { if (pending) { pending = false; resolve(value); } }
9801
+ function onRejection(reason) { if (pending) { pending = false; reject(reason); } }
9202
9802
 
9203
- if (promise && typeof promise.then === 'function') {
9204
- promise.then(resolve, reject, "RSVP: RSVP#race");
9803
+ for (var i = 0; i < entries.length; i++) {
9804
+ entry = entries[i];
9805
+ if (isNonThenable(entry)) {
9806
+ pending = false;
9807
+ resolve(entry);
9808
+ return;
9205
9809
  } else {
9206
- resolve(promise);
9810
+ Constructor.cast(entry).then(onFulfillment, onRejection);
9207
9811
  }
9208
9812
  }
9209
9813
  }, label);
9210
- }
9211
-
9212
- __exports__.race = race;
9814
+ };
9213
9815
  });
9214
- define("rsvp/reject",
9215
- ["./promise","exports"],
9216
- function(__dependency1__, __exports__) {
9816
+ define("rsvp/promise/reject",
9817
+ ["exports"],
9818
+ function(__exports__) {
9217
9819
  "use strict";
9218
- var Promise = __dependency1__.Promise;
9219
-
9220
9820
  /**
9221
- `RSVP.reject` returns a promise that will become rejected with the passed
9222
- `reason`. `RSVP.reject` is essentially shorthand for the following:
9821
+ `RSVP.Promise.reject` returns a promise rejected with the passed `reason`.
9822
+ It is shorthand for the following:
9223
9823
 
9224
9824
  ```javascript
9225
9825
  var promise = new RSVP.Promise(function(resolve, reject){
@@ -9236,7 +9836,7 @@ define("rsvp/reject",
9236
9836
  Instead of writing the above, your code now simply becomes the following:
9237
9837
 
9238
9838
  ```javascript
9239
- var promise = RSVP.reject(new Error('WHOOPS'));
9839
+ var promise = RSVP.Promise.reject(new Error('WHOOPS'));
9240
9840
 
9241
9841
  promise.then(function(value){
9242
9842
  // Code here doesn't run because the promise is rejected!
@@ -9246,30 +9846,28 @@ define("rsvp/reject",
9246
9846
  ```
9247
9847
 
9248
9848
  @method reject
9249
- @for RSVP
9250
9849
  @param {Any} reason value that the returned promise will be rejected with.
9251
9850
  @param {String} label optional string for identifying the returned promise.
9252
9851
  Useful for tooling.
9253
- @return {Promise} a promise that will become rejected with the given
9254
- `reason`.
9852
+ @return {Promise} a promise rejected with the given `reason`.
9853
+ @static
9255
9854
  */
9256
- function reject(reason, label) {
9257
- return new Promise(function (resolve, reject) {
9855
+ __exports__["default"] = function reject(reason, label) {
9856
+ /*jshint validthis:true */
9857
+ var Constructor = this;
9858
+
9859
+ return new Constructor(function (resolve, reject) {
9258
9860
  reject(reason);
9259
9861
  }, label);
9260
- }
9261
-
9262
- __exports__.reject = reject;
9862
+ };
9263
9863
  });
9264
- define("rsvp/resolve",
9265
- ["./promise","exports"],
9266
- function(__dependency1__, __exports__) {
9864
+ define("rsvp/promise/resolve",
9865
+ ["exports"],
9866
+ function(__exports__) {
9267
9867
  "use strict";
9268
- var Promise = __dependency1__.Promise;
9269
-
9270
9868
  /**
9271
- `RSVP.resolve` returns a promise that will become fulfilled with the passed
9272
- `value`. `RSVP.resolve` is essentially shorthand for the following:
9869
+ `RSVP.Promise.resolve` returns a promise that will become resolved with the
9870
+ passed `value`. It is shorthand for the following:
9273
9871
 
9274
9872
  ```javascript
9275
9873
  var promise = new RSVP.Promise(function(resolve, reject){
@@ -9284,7 +9882,7 @@ define("rsvp/resolve",
9284
9882
  Instead of writing the above, your code now simply becomes the following:
9285
9883
 
9286
9884
  ```javascript
9287
- var promise = RSVP.resolve(1);
9885
+ var promise = RSVP.Promise.resolve(1);
9288
9886
 
9289
9887
  promise.then(function(value){
9290
9888
  // value === 1
@@ -9292,27 +9890,88 @@ define("rsvp/resolve",
9292
9890
  ```
9293
9891
 
9294
9892
  @method resolve
9295
- @for RSVP
9296
9893
  @param {Any} value value that the returned promise will be resolved with
9297
9894
  @param {String} label optional string for identifying the returned promise.
9298
9895
  Useful for tooling.
9299
9896
  @return {Promise} a promise that will become fulfilled with the given
9300
9897
  `value`
9898
+ @static
9301
9899
  */
9302
- function resolve(value, label) {
9303
- return new Promise(function(resolve, reject) {
9900
+ __exports__["default"] = function resolve(value, label) {
9901
+ /*jshint validthis:true */
9902
+ var Constructor = this;
9903
+
9904
+ return new Constructor(function(resolve, reject) {
9304
9905
  resolve(value);
9305
9906
  }, label);
9306
- }
9907
+ };
9908
+ });
9909
+ define("rsvp/race",
9910
+ ["./promise","exports"],
9911
+ function(__dependency1__, __exports__) {
9912
+ "use strict";
9913
+ var Promise = __dependency1__["default"];
9307
9914
 
9308
- __exports__.resolve = resolve;
9915
+ /**
9916
+ This is a convenient alias for `RSVP.Promise.race`.
9917
+
9918
+ @method race
9919
+ @param {Array} array Array of promises.
9920
+ @param {String} label An optional label. This is useful
9921
+ for tooling.
9922
+ @static
9923
+ */
9924
+ __exports__["default"] = function race(array, label) {
9925
+ return Promise.race(array, label);
9926
+ };
9927
+ });
9928
+ define("rsvp/reject",
9929
+ ["./promise","exports"],
9930
+ function(__dependency1__, __exports__) {
9931
+ "use strict";
9932
+ var Promise = __dependency1__["default"];
9933
+
9934
+ /**
9935
+ This is a convenient alias for `RSVP.Promise.reject`.
9936
+
9937
+ @method reject
9938
+ @for RSVP
9939
+ @param {Any} reason value that the returned promise will be rejected with.
9940
+ @param {String} label optional string for identifying the returned promise.
9941
+ Useful for tooling.
9942
+ @return {Promise} a promise rejected with the given `reason`.
9943
+ @static
9944
+ */
9945
+ __exports__["default"] = function reject(reason, label) {
9946
+ return Promise.reject(reason, label);
9947
+ };
9948
+ });
9949
+ define("rsvp/resolve",
9950
+ ["./promise","exports"],
9951
+ function(__dependency1__, __exports__) {
9952
+ "use strict";
9953
+ var Promise = __dependency1__["default"];
9954
+
9955
+ /**
9956
+ This is a convenient alias for `RSVP.Promise.resolve`.
9957
+
9958
+ @method resolve
9959
+ @for RSVP
9960
+ @param {Any} value value that the returned promise will be resolved with
9961
+ @param {String} label optional string for identifying the returned promise.
9962
+ Useful for tooling.
9963
+ @return {Promise} a promise that will become fulfilled with the given
9964
+ `value`
9965
+ @static
9966
+ */
9967
+ __exports__["default"] = function resolve(value, label) {
9968
+ return Promise.resolve(value, label);
9969
+ };
9309
9970
  });
9310
9971
  define("rsvp/rethrow",
9311
9972
  ["exports"],
9312
9973
  function(__exports__) {
9313
9974
  "use strict";
9314
- var local = (typeof global === "undefined") ? this : global;
9315
-
9316
9975
  /**
9317
9976
  `RSVP.rethrow` will rethrow an error on the next turn of the JavaScript event
9318
9977
  loop in order to aid debugging.
@@ -9322,8 +9981,8 @@ define("rsvp/rethrow",
9322
9981
  this reason, it is recommended that you always specify a second rejection
9323
9982
  handler function to `then`. However, `RSVP.rethrow` will throw the exception
9324
9983
  outside of the promise, so it bubbles up to your console if in the browser,
9325
- or domain/cause uncaught exception in Node. `rethrow` will throw the error
9326
- again so the error can be handled by the promise.
9984
+ or domain/cause uncaught exception in Node. `rethrow` will also throw the
9985
+ error again so the error can be handled by the promise per the spec.
9327
9986
 
9328
9987
  ```javascript
9329
9988
  function throws(){
@@ -9334,7 +9993,7 @@ define("rsvp/rethrow",
9334
9993
  throws();
9335
9994
  });
9336
9995
 
9337
- promise.fail(RSVP.rethrow).then(function(){
9996
+ promise.catch(RSVP.rethrow).then(function(){
9338
9997
  // Code here doesn't run because the promise became rejected due to an
9339
9998
  // error!
9340
9999
  }, function (err){
@@ -9344,64 +10003,75 @@ define("rsvp/rethrow",
9344
10003
 
9345
10004
  The 'Whoops' error will be thrown on the next turn of the event loop
9346
10005
  and you can watch for it in your console. You can also handle it using a
9347
- rejection handler given to `.then` or `.fail` on the returned promise.
10006
+ rejection handler given to `.then` or `.catch` on the returned promise.
9348
10007
 
9349
10008
  @method rethrow
9350
10009
  @for RSVP
9351
10010
  @param {Error} reason reason the promise became rejected.
9352
10011
  @throws Error
10012
+ @static
9353
10013
  */
9354
- function rethrow(reason) {
9355
- local.setTimeout(function() {
10014
+ __exports__["default"] = function rethrow(reason) {
10015
+ setTimeout(function() {
9356
10016
  throw reason;
9357
10017
  });
9358
10018
  throw reason;
9359
- }
9360
-
9361
- __exports__.rethrow = rethrow;
10019
+ };
9362
10020
  });
9363
10021
  define("rsvp/utils",
9364
10022
  ["exports"],
9365
10023
  function(__exports__) {
9366
10024
  "use strict";
9367
10025
  function objectOrFunction(x) {
9368
- return isFunction(x) || (typeof x === "object" && x !== null);
10026
+ return typeof x === "function" || (typeof x === "object" && x !== null);
9369
10027
  }
9370
10028
 
9371
- function isFunction(x) {
10029
+ __exports__.objectOrFunction = objectOrFunction;function isFunction(x) {
9372
10030
  return typeof x === "function";
9373
10031
  }
9374
10032
 
9375
- function isArray(x) {
10033
+ __exports__.isFunction = isFunction;function isNonThenable(x) {
10034
+ return !objectOrFunction(x);
10035
+ }
10036
+
10037
+ __exports__.isNonThenable = isNonThenable;function isArray(x) {
9376
10038
  return Object.prototype.toString.call(x) === "[object Array]";
9377
10039
  }
9378
10040
 
9379
- // Date.now is not available in browsers < IE9
10041
+ __exports__.isArray = isArray;// Date.now is not available in browsers < IE9
9380
10042
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
9381
10043
  var now = Date.now || function() { return new Date().getTime(); };
10044
+ __exports__.now = now;
10045
+ var keysOf = Object.keys || function(object) {
10046
+ var result = [];
9382
10047
 
10048
+ for (var prop in object) {
10049
+ result.push(prop);
10050
+ }
9383
10051
 
9384
- __exports__.objectOrFunction = objectOrFunction;
9385
- __exports__.isFunction = isFunction;
9386
- __exports__.isArray = isArray;
9387
- __exports__.now = now;
10052
+ return result;
10053
+ };
10054
+ __exports__.keysOf = keysOf;
9388
10055
  });
9389
10056
  define("rsvp",
9390
- ["./rsvp/events","./rsvp/promise","./rsvp/node","./rsvp/all","./rsvp/race","./rsvp/hash","./rsvp/rethrow","./rsvp/defer","./rsvp/config","./rsvp/resolve","./rsvp/reject", "exports"],
9391
- function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __exports__) {
10057
+ ["./rsvp/promise","./rsvp/events","./rsvp/node","./rsvp/all","./rsvp/all_settled","./rsvp/race","./rsvp/hash","./rsvp/rethrow","./rsvp/defer","./rsvp/config","./rsvp/map","./rsvp/resolve","./rsvp/reject","./rsvp/filter","exports"],
10058
+ function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __dependency14__, __exports__) {
9392
10059
  "use strict";
9393
- var EventTarget = __dependency1__.EventTarget;
9394
- var Promise = __dependency2__.Promise;
9395
- var denodeify = __dependency3__.denodeify;
9396
- var all = __dependency4__.all;
9397
- var race = __dependency5__.race;
9398
- var hash = __dependency6__.hash;
9399
- var rethrow = __dependency7__.rethrow;
9400
- var defer = __dependency8__.defer;
9401
- var config = __dependency9__.config;
9402
- var configure = __dependency9__.configure;
9403
- var resolve = __dependency10__.resolve;
9404
- var reject = __dependency11__.reject;
10060
+ var Promise = __dependency1__["default"];
10061
+ var EventTarget = __dependency2__["default"];
10062
+ var denodeify = __dependency3__["default"];
10063
+ var all = __dependency4__["default"];
10064
+ var allSettled = __dependency5__["default"];
10065
+ var race = __dependency6__["default"];
10066
+ var hash = __dependency7__["default"];
10067
+ var rethrow = __dependency8__["default"];
10068
+ var defer = __dependency9__["default"];
10069
+ var config = __dependency10__.config;
10070
+ var configure = __dependency10__.configure;
10071
+ var map = __dependency11__["default"];
10072
+ var resolve = __dependency12__["default"];
10073
+ var reject = __dependency13__["default"];
10074
+ var filter = __dependency14__["default"];
9405
10075
 
9406
10076
  function async(callback, arg) {
9407
10077
  config.async(callback, arg);
@@ -9415,9 +10085,21 @@ define("rsvp",
9415
10085
  config.off.apply(config, arguments);
9416
10086
  }
9417
10087
 
10088
+ // Set up instrumentation through `window.__PROMISE_INTRUMENTATION__`
10089
+ if (typeof window !== 'undefined' && typeof window.__PROMISE_INSTRUMENTATION__ === 'object') {
10090
+ var callbacks = window.__PROMISE_INSTRUMENTATION__;
10091
+ configure('instrument', true);
10092
+ for (var eventName in callbacks) {
10093
+ if (callbacks.hasOwnProperty(eventName)) {
10094
+ on(eventName, callbacks[eventName]);
10095
+ }
10096
+ }
10097
+ }
10098
+
9418
10099
  __exports__.Promise = Promise;
9419
10100
  __exports__.EventTarget = EventTarget;
9420
10101
  __exports__.all = all;
10102
+ __exports__.allSettled = allSettled;
9421
10103
  __exports__.race = race;
9422
10104
  __exports__.hash = hash;
9423
10105
  __exports__.rethrow = rethrow;
@@ -9429,16 +10111,18 @@ define("rsvp",
9429
10111
  __exports__.resolve = resolve;
9430
10112
  __exports__.reject = reject;
9431
10113
  __exports__.async = async;
10114
+ __exports__.map = map;
10115
+ __exports__.filter = filter;
9432
10116
  });
9433
10117
 
9434
10118
  })();
9435
10119
 
9436
10120
  (function() {
9437
10121
  /**
9438
- @private
9439
10122
  Public api for the container is still in flux.
9440
10123
  The public api, specified on the application namespace should be considered the stable api.
9441
10124
  // @module container
10125
+ @private
9442
10126
  */
9443
10127
 
9444
10128
  /*
@@ -9451,7 +10135,6 @@ Ember.MODEL_FACTORY_INJECTIONS = false || !!Ember.ENV.MODEL_FACTORY_INJECTIONS;
9451
10135
  define("container",
9452
10136
  [],
9453
10137
  function() {
9454
- "use strict";
9455
10138
 
9456
10139
  // A safe and simple inheriting object.
9457
10140
  function InheritingDict(parent) {
@@ -9573,8 +10256,7 @@ define("container",
9573
10256
 
9574
10257
  this.registry = new InheritingDict(parent && parent.registry);
9575
10258
  this.cache = new InheritingDict(parent && parent.cache);
9576
- this.factoryCache = new InheritingDict(parent && parent.factoryCache);
9577
- this.resolveCache = new InheritingDict(parent && parent.resolveCache);
10259
+ this.factoryCache = new InheritingDict(parent && parent.cache);
9578
10260
  this.typeInjections = new InheritingDict(parent && parent.typeInjections);
9579
10261
  this.injections = {};
9580
10262
 
@@ -9695,7 +10377,9 @@ define("container",
9695
10377
  @param {Object} options
9696
10378
  */
9697
10379
  register: function(fullName, factory, options) {
9698
- validateFullName(fullName);
10380
+ if (fullName.indexOf(':') === -1) {
10381
+ throw new TypeError("malformed fullName, expected: `type:name` got: " + fullName + "");
10382
+ }
9699
10383
 
9700
10384
  if (factory === undefined) {
9701
10385
  throw new TypeError('Attempting to register an unknown factory: `' + fullName + '`');
@@ -9728,14 +10412,11 @@ define("container",
9728
10412
  @param {String} fullName
9729
10413
  */
9730
10414
  unregister: function(fullName) {
9731
- validateFullName(fullName);
9732
-
9733
10415
  var normalizedName = this.normalize(fullName);
9734
10416
 
9735
10417
  this.registry.remove(normalizedName);
9736
10418
  this.cache.remove(normalizedName);
9737
10419
  this.factoryCache.remove(normalizedName);
9738
- this.resolveCache.remove(normalizedName);
9739
10420
  this._options.remove(normalizedName);
9740
10421
  },
9741
10422
 
@@ -9772,18 +10453,7 @@ define("container",
9772
10453
  @return {Function} fullName's factory
9773
10454
  */
9774
10455
  resolve: function(fullName) {
9775
- validateFullName(fullName);
9776
-
9777
- var normalizedName = this.normalize(fullName);
9778
- var cached = this.resolveCache.get(normalizedName);
9779
-
9780
- if (cached) { return cached; }
9781
-
9782
- var resolved = this.resolver(normalizedName) || this.registry.get(normalizedName);
9783
-
9784
- this.resolveCache.set(normalizedName, resolved);
9785
-
9786
- return resolved;
10456
+ return this.resolver(fullName) || this.registry.get(fullName);
9787
10457
  },
9788
10458
 
9789
10459
  /**
@@ -9864,8 +10534,23 @@ define("container",
9864
10534
  @return {any}
9865
10535
  */
9866
10536
  lookup: function(fullName, options) {
9867
- validateFullName(fullName);
9868
- return lookup(this, this.normalize(fullName), options);
10537
+ fullName = this.normalize(fullName);
10538
+
10539
+ options = options || {};
10540
+
10541
+ if (this.cache.has(fullName) && options.singleton !== false) {
10542
+ return this.cache.get(fullName);
10543
+ }
10544
+
10545
+ var value = instantiate(this, fullName);
10546
+
10547
+ if (value === undefined) { return; }
10548
+
10549
+ if (isSingleton(this, fullName) && options.singleton !== false) {
10550
+ this.cache.set(fullName, value);
10551
+ }
10552
+
10553
+ return value;
9869
10554
  },
9870
10555
 
9871
10556
  /**
@@ -9876,8 +10561,7 @@ define("container",
9876
10561
  @return {any}
9877
10562
  */
9878
10563
  lookupFactory: function(fullName) {
9879
- validateFullName(fullName);
9880
- return factoryFor(this, this.normalize(fullName));
10564
+ return factoryFor(this, fullName);
9881
10565
  },
9882
10566
 
9883
10567
  /**
@@ -9889,8 +10573,11 @@ define("container",
9889
10573
  @return {Boolean}
9890
10574
  */
9891
10575
  has: function(fullName) {
9892
- validateFullName(fullName);
9893
- return has(this, this.normalize(fullName));
10576
+ if (this.cache.has(fullName)) {
10577
+ return true;
10578
+ }
10579
+
10580
+ return !!this.resolve(fullName);
9894
10581
  },
9895
10582
 
9896
10583
  /**
@@ -9936,8 +10623,6 @@ define("container",
9936
10623
  },
9937
10624
 
9938
10625
  /**
9939
- @private
9940
-
9941
10626
  Used only via `injection`.
9942
10627
 
9943
10628
  Provides a specialized form of injection, specifically enabling
@@ -9966,13 +10651,13 @@ define("container",
9966
10651
  user.router === post.router; //=> true
9967
10652
  ```
9968
10653
 
10654
+ @private
9969
10655
  @method typeInjection
9970
10656
  @param {String} type
9971
10657
  @param {String} property
9972
10658
  @param {String} fullName
9973
10659
  */
9974
10660
  typeInjection: function(type, property, fullName) {
9975
- validateFullName(fullName);
9976
10661
  if (this.parent) { illegalChildOperation('typeInjection'); }
9977
10662
 
9978
10663
  addTypeInjection(this.typeInjections, type, property, fullName);
@@ -10022,26 +10707,18 @@ define("container",
10022
10707
  @param {String} property
10023
10708
  @param {String} injectionName
10024
10709
  */
10025
- injection: function(fullName, property, injectionName) {
10710
+ injection: function(factoryName, property, injectionName) {
10026
10711
  if (this.parent) { illegalChildOperation('injection'); }
10027
10712
 
10028
- validateFullName(injectionName);
10029
- var normalizedInjectionName = this.normalize(injectionName);
10030
-
10031
- if (fullName.indexOf(':') === -1) {
10032
- return this.typeInjection(fullName, property, normalizedInjectionName);
10713
+ if (factoryName.indexOf(':') === -1) {
10714
+ return this.typeInjection(factoryName, property, injectionName);
10033
10715
  }
10034
10716
 
10035
- validateFullName(fullName);
10036
- var normalizedName = this.normalize(fullName);
10037
-
10038
- addInjection(this.injections, normalizedName, property, normalizedInjectionName);
10717
+ addInjection(this.injections, factoryName, property, injectionName);
10039
10718
  },
10040
10719
 
10041
10720
 
10042
10721
  /**
10043
- @private
10044
-
10045
10722
  Used only via `factoryInjection`.
10046
10723
 
10047
10724
  Provides a specialized form of injection, specifically enabling
@@ -10064,6 +10741,7 @@ define("container",
10064
10741
  UserFactory.store instanceof SomeStore; //=> true
10065
10742
  ```
10066
10743
 
10744
+ @private
10067
10745
  @method factoryTypeInjection
10068
10746
  @param {String} type
10069
10747
  @param {String} property
@@ -10072,7 +10750,7 @@ define("container",
10072
10750
  factoryTypeInjection: function(type, property, fullName) {
10073
10751
  if (this.parent) { illegalChildOperation('factoryTypeInjection'); }
10074
10752
 
10075
- addTypeInjection(this.factoryTypeInjections, type, property, this.normalize(fullName));
10753
+ addTypeInjection(this.factoryTypeInjections, type, property, fullName);
10076
10754
  },
10077
10755
 
10078
10756
  /**
@@ -10124,21 +10802,14 @@ define("container",
10124
10802
  @param {String} property
10125
10803
  @param {String} injectionName
10126
10804
  */
10127
- factoryInjection: function(fullName, property, injectionName) {
10805
+ factoryInjection: function(factoryName, property, injectionName) {
10128
10806
  if (this.parent) { illegalChildOperation('injection'); }
10129
10807
 
10130
- var normalizedName = this.normalize(fullName);
10131
- var normalizedInjectionName = this.normalize(injectionName);
10132
-
10133
- validateFullName(injectionName);
10134
-
10135
- if (fullName.indexOf(':') === -1) {
10136
- return this.factoryTypeInjection(normalizedName, property, normalizedInjectionName);
10808
+ if (factoryName.indexOf(':') === -1) {
10809
+ return this.factoryTypeInjection(factoryName, property, injectionName);
10137
10810
  }
10138
10811
 
10139
- validateFullName(fullName);
10140
-
10141
- addInjection(this.factoryInjections, normalizedName, property, normalizedInjectionName);
10812
+ addInjection(this.factoryInjections, factoryName, property, injectionName);
10142
10813
  },
10143
10814
 
10144
10815
  /**
@@ -10148,6 +10819,7 @@ define("container",
10148
10819
  @method destroy
10149
10820
  */
10150
10821
  destroy: function() {
10822
+
10151
10823
  for (var i=0, l=this.children.length; i<l; i++) {
10152
10824
  this.children[i].destroy();
10153
10825
  }
@@ -10173,32 +10845,6 @@ define("container",
10173
10845
  }
10174
10846
  };
10175
10847
 
10176
- function has(container, fullName){
10177
- if (container.cache.has(fullName)) {
10178
- return true;
10179
- }
10180
-
10181
- return !!container.resolve(fullName);
10182
- }
10183
-
10184
- function lookup(container, fullName, options) {
10185
- options = options || {};
10186
-
10187
- if (container.cache.has(fullName) && options.singleton !== false) {
10188
- return container.cache.get(fullName);
10189
- }
10190
-
10191
- var value = instantiate(container, fullName);
10192
-
10193
- if (value === undefined) { return; }
10194
-
10195
- if (isSingleton(container, fullName) && options.singleton !== false) {
10196
- container.cache.set(fullName, value);
10197
- }
10198
-
10199
- return value;
10200
- }
10201
-
10202
10848
  function illegalChildOperation(operation) {
10203
10849
  throw new Error(operation + " is not currently supported on child containers");
10204
10850
  }
@@ -10214,14 +10860,14 @@ define("container",
10214
10860
 
10215
10861
  if (!injections) { return hash; }
10216
10862
 
10217
- var injection, injectable;
10863
+ var injection, lookup;
10218
10864
 
10219
10865
  for (var i=0, l=injections.length; i<l; i++) {
10220
10866
  injection = injections[i];
10221
- injectable = lookup(container, injection.fullName);
10867
+ lookup = container.lookup(injection.fullName);
10222
10868
 
10223
- if (injectable !== undefined) {
10224
- hash[injection.property] = injectable;
10869
+ if (lookup !== undefined) {
10870
+ hash[injection.property] = lookup;
10225
10871
  } else {
10226
10872
  throw new Error('Attempting to inject an unknown injection: `' + injection.fullName + '`');
10227
10873
  }
@@ -10246,7 +10892,7 @@ define("container",
10246
10892
  }
10247
10893
 
10248
10894
  function factoryFor(container, fullName) {
10249
- var name = fullName;
10895
+ var name = container.normalize(fullName);
10250
10896
  var factory = container.resolve(name);
10251
10897
  var injectedFactory;
10252
10898
  var cache = container.factoryCache;
@@ -10356,13 +11002,6 @@ define("container",
10356
11002
  });
10357
11003
  }
10358
11004
 
10359
- var VALID_FULL_NAME_REGEXP = /^[^:]+.+:[^:]+$/;
10360
- function validateFullName(fullName) {
10361
- if (!VALID_FULL_NAME_REGEXP.test(fullName)) {
10362
- throw new TypeError('Invalid Fullname, expected: `type:name` got: ' + fullName);
10363
- }
10364
- }
10365
-
10366
11005
  function addInjection(rules, factoryName, property, injectionName) {
10367
11006
  var injections = rules[factoryName] = rules[factoryName] || [];
10368
11007
  injections.push({ property: property, fullName: injectionName });
@@ -10557,6 +11196,39 @@ Ember.copy = function(obj, deep) {
10557
11196
  return _copy(obj, deep, deep ? [] : null, deep ? [] : null);
10558
11197
  };
10559
11198
 
11199
+ /**
11200
+ Convenience method to inspect an object. This method will attempt to
11201
+ convert the object into a useful string description.
11202
+
11203
+ It is a pretty simple implementation. If you want something more robust,
11204
+ use something like JSDump: https://github.com/NV/jsDump
11205
+
11206
+ @method inspect
11207
+ @for Ember
11208
+ @param {Object} obj The object you want to inspect.
11209
+ @return {String} A description of the object
11210
+ */
11211
+ Ember.inspect = function(obj) {
11212
+ var type = Ember.typeOf(obj);
11213
+ if (type === 'array') {
11214
+ return '[' + obj + ']';
11215
+ }
11216
+ if (type !== 'object') {
11217
+ return obj + '';
11218
+ }
11219
+
11220
+ var v, ret = [];
11221
+ for(var key in obj) {
11222
+ if (obj.hasOwnProperty(key)) {
11223
+ v = obj[key];
11224
+ if (v === 'toString') { continue; } // ignore useless items
11225
+ if (Ember.typeOf(v) === 'function') { v = "function() { ... }"; }
11226
+ ret.push(key + ": " + v);
11227
+ }
11228
+ }
11229
+ return "{" + ret.join(", ") + "}";
11230
+ };
11231
+
10560
11232
  /**
10561
11233
  Compares two objects, returning true if they are logically equal. This is
10562
11234
  a deeper comparison than a simple triple equal. For sets it will compare the
@@ -10661,10 +11333,6 @@ var STRING_DECAMELIZE_REGEXP = (/([a-z\d])([A-Z])/g);
10661
11333
  var STRING_CAMELIZE_REGEXP = (/(\-|_|\.|\s)+(.)?/g);
10662
11334
  var STRING_UNDERSCORE_REGEXP_1 = (/([a-z\d])([A-Z]+)/g);
10663
11335
  var STRING_UNDERSCORE_REGEXP_2 = (/\-|\s+/g);
10664
- var STRING_PARAMETERIZE_REGEXP_1 = (/[_|\/|\s]+/g);
10665
- var STRING_PARAMETERIZE_REGEXP_2 = (/[^a-z0-9\-]+/gi);
10666
- var STRING_PARAMETERIZE_REGEXP_3 = (/[\-]+/g);
10667
- var STRING_PARAMETERIZE_REGEXP_4 = (/^-+|-+$/g);
10668
11336
 
10669
11337
  /**
10670
11338
  Defines the hash of localized strings for the current language. Used by
@@ -10903,54 +11571,6 @@ Ember.String = {
10903
11571
  }
10904
11572
  };
10905
11573
 
10906
- if (Ember.FEATURES.isEnabled("string-humanize")) {
10907
- /**
10908
- Returns the Humanized form of a string
10909
-
10910
- Replaces underscores with spaces, and capitializes first character
10911
- of string. Also strips "_id" suffixes.
10912
-
10913
- ```javascript
10914
- 'first_name'.humanize() // 'First name'
10915
- 'user_id'.humanize() // 'User'
10916
- ```
10917
-
10918
- @method humanize
10919
- @param {String} str The string to humanize.
10920
- @return {String} The humanized string.
10921
- */
10922
-
10923
- Ember.String.humanize = function(str) {
10924
- return str.replace(/_id$/, '').
10925
- replace(/_/g, ' ').
10926
- replace(/^\w/g, function(s){
10927
- return s.toUpperCase();
10928
- });
10929
- };
10930
- }
10931
-
10932
- if (Ember.FEATURES.isEnabled("string-parameterize")) {
10933
- /**
10934
- Transforms a string so that it may be used as part of a 'pretty' / SEO friendly URL.
10935
-
10936
- ```javascript
10937
- 'My favorite items.'.parameterize(); // 'my-favorite-items'
10938
- 'action_name'.parameterize(); // 'action-name'
10939
- '100 ways Ember.js is better than Angular.'.parameterize(); // '100-ways-emberjs-is-better-than-angular'
10940
- ```
10941
-
10942
- @method parameterize
10943
- @param {String} str The string to parameterize.
10944
- @return {String} the parameterized string.
10945
- */
10946
- Ember.String.parameterize = function(str) {
10947
- return str.replace(STRING_PARAMETERIZE_REGEXP_1, '-') // replace underscores, slashes and spaces with separator
10948
- .replace(STRING_PARAMETERIZE_REGEXP_2, '') // remove non-alphanumeric characters except the separator
10949
- .replace(STRING_PARAMETERIZE_REGEXP_3, '-') // replace multiple occurring separators
10950
- .replace(STRING_PARAMETERIZE_REGEXP_4, '') // trim leading and trailing separators
10951
- .toLowerCase();
10952
- };
10953
- }
10954
11574
 
10955
11575
 
10956
11576
  })();
@@ -10975,13 +11595,6 @@ var fmt = Ember.String.fmt,
10975
11595
  capitalize = Ember.String.capitalize,
10976
11596
  classify = Ember.String.classify;
10977
11597
 
10978
- if (Ember.FEATURES.isEnabled("string-humanize")) {
10979
- var humanize = Ember.String.humanize;
10980
- }
10981
-
10982
- if (Ember.FEATURES.isEnabled("string-parameterize")) {
10983
- var parameterize = Ember.String.parameterize;
10984
- }
10985
11598
 
10986
11599
  if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.String) {
10987
11600
 
@@ -11075,30 +11688,7 @@ if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.String) {
11075
11688
  return capitalize(this);
11076
11689
  };
11077
11690
 
11078
- if (Ember.FEATURES.isEnabled("string-humanize")) {
11079
- /**
11080
- See [Ember.String.humanize](/api/classes/Ember.String.html#method_humanize).
11081
-
11082
- @method humanize
11083
- @for String
11084
- */
11085
- String.prototype.humanize = function() {
11086
- return humanize(this);
11087
- };
11088
- }
11089
-
11090
- if (Ember.FEATURES.isEnabled("string-parameterize")) {
11091
- /**
11092
- See [Ember.String.parameterize](/api/classes/Ember.String.html#method_parameterize).
11093
-
11094
- @method parameterize
11095
- @for String
11096
- */
11097
- String.prototype.parameterize = function() {
11098
- return parameterize(this);
11099
- };
11100
- }
11101
-
11691
+
11102
11692
  }
11103
11693
 
11104
11694
 
@@ -11699,7 +12289,9 @@ function makeCtor() {
11699
12289
 
11700
12290
  Ember.assert("Ember.Object.create no longer supports defining computed properties.", !(value instanceof Ember.ComputedProperty));
11701
12291
  Ember.assert("Ember.Object.create no longer supports defining methods that call _super.", !(typeof value === 'function' && value.toString().indexOf('._super') !== -1));
11702
- Ember.assert("`actions` must be provided at extend time, not at create time, when Ember.ActionHandler is used (i.e. views, controllers & routes).", !((keyName === 'actions') && Ember.ActionHandler.detect(this)));
12292
+ Ember.assert("`actions` must be provided at extend time, not at create " +
12293
+ "time, when Ember.ActionHandler is used (i.e. views, " +
12294
+ "controllers & routes).", !((keyName === 'actions') && Ember.ActionHandler.detect(this)));
11703
12295
 
11704
12296
  if (concatenatedProperties && indexOf(concatenatedProperties, keyName) >= 0) {
11705
12297
  var baseValue = this[keyName];
@@ -11927,11 +12519,10 @@ CoreObject.PrototypeMixin = Mixin.create({
11927
12519
  willDestroy: Ember.K,
11928
12520
 
11929
12521
  /**
11930
- @private
11931
-
11932
12522
  Invoked by the run loop to actually destroy the object. This is
11933
12523
  scheduled for execution by the `destroy` method.
11934
12524
 
12525
+ @private
11935
12526
  @method _scheduledDestroy
11936
12527
  */
11937
12528
  _scheduledDestroy: function() {
@@ -12682,7 +13273,7 @@ function contentPropertyDidChange(content, contentKey) {
12682
13273
  @namespace Ember
12683
13274
  @extends Ember.Object
12684
13275
  */
12685
- Ember.ObjectProxy = Ember.Object.extend(/** @scope Ember.ObjectProxy.prototype */ {
13276
+ Ember.ObjectProxy = Ember.Object.extend({
12686
13277
  /**
12687
13278
  The object whose properties will be forwarded.
12688
13279
 
@@ -13471,7 +14062,7 @@ Ember.Enumerable = Ember.Mixin.create({
13471
14062
  var ret = initialValue;
13472
14063
 
13473
14064
  this.forEach(function(item, i) {
13474
- ret = callback(ret, item, i, this, reducerProperty);
14065
+ ret = callback.call(null, ret, item, i, this, reducerProperty);
13475
14066
  }, this);
13476
14067
 
13477
14068
  return ret;
@@ -13494,7 +14085,7 @@ Ember.Enumerable = Ember.Mixin.create({
13494
14085
  this.forEach(function(x, idx) {
13495
14086
  var method = x && x[methodName];
13496
14087
  if ('function' === typeof method) {
13497
- ret[idx] = args ? method.apply(x, args) : x[methodName]();
14088
+ ret[idx] = args ? method.apply(x, args) : method.call(x);
13498
14089
  }
13499
14090
  }, this);
13500
14091
 
@@ -13689,6 +14280,8 @@ Ember.Enumerable = Ember.Mixin.create({
13689
14280
  notify range observers.
13690
14281
 
13691
14282
  @method enumerableContentDidChange
14283
+ @param {Number} [start] optional start offset for the content change.
14284
+ For unordered enumerables, you should always pass -1.
13692
14285
  @param {Ember.Enumerable|Number} removing An enumerable of the objects to
13693
14286
  be removed or the number of items to be removed.
13694
14287
  @param {Ember.Enumerable|Number} adding An enumerable of the objects to
@@ -13795,7 +14388,7 @@ var get = Ember.get, set = Ember.set, isNone = Ember.isNone, map = Ember.Enumera
13795
14388
  @uses Ember.Enumerable
13796
14389
  @since Ember 0.9.0
13797
14390
  */
13798
- Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.prototype */ {
14391
+ Ember.Array = Ember.Mixin.create(Ember.Enumerable, {
13799
14392
 
13800
14393
  /**
13801
14394
  Your array must support the `length` property. Your replace methods should
@@ -13898,7 +14491,7 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
13898
14491
 
13899
14492
  @method slice
13900
14493
  @param {Integer} beginIndex (Optional) index to begin slicing from.
13901
- @param {Integer} endIndex (Optional) index to end the slice at (but not included).
14494
+ @param {Integer} endIndex (Optional) index to end the slice at.
13902
14495
  @return {Array} New array with specified slice
13903
14496
  */
13904
14497
  slice: function(beginIndex, endIndex) {
@@ -14049,7 +14642,7 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
14049
14642
  Becomes true whenever the array currently has observers watching changes
14050
14643
  on the array.
14051
14644
 
14052
- @property {Boolean} hasArrayObservers
14645
+ @property Boolean
14053
14646
  */
14054
14647
  hasArrayObservers: Ember.computed(function() {
14055
14648
  return Ember.hasListeners(this, '@array:change') || Ember.hasListeners(this, '@array:before');
@@ -14198,9 +14791,6 @@ var e_get = Ember.get,
14198
14791
  doubleEachPropertyPattern = /(.*\.@each){2,}/,
14199
14792
  arrayBracketPattern = /\.\[\]$/;
14200
14793
 
14201
- if (Ember.FEATURES.isEnabled('propertyBraceExpansion')) {
14202
- var expandProperties = Ember.expandProperties;
14203
- }
14204
14794
 
14205
14795
  function get(obj, key) {
14206
14796
  if (key === '@this') {
@@ -14658,9 +15248,7 @@ function ReduceComputedProperty(options) {
14658
15248
 
14659
15249
  meta.dependentArraysObserver.suspendArrayObservers(function () {
14660
15250
  forEach(cp._dependentKeys, function (dependentKey) {
14661
-
14662
- if (!partiallyRecomputeFor(this, dependentKey)) { return; }
14663
-
15251
+ if (!partiallyRecomputeFor(this, dependentKey)) { return; }
14664
15252
 
14665
15253
  var dependentArray = get(this, dependentKey),
14666
15254
  previousDependentArray = meta.dependentArrays[dependentKey];
@@ -14689,9 +15277,7 @@ function ReduceComputedProperty(options) {
14689
15277
  }, this);
14690
15278
 
14691
15279
  forEach(cp._dependentKeys, function(dependentKey) {
14692
-
14693
- if (!partiallyRecomputeFor(this, dependentKey)) { return; }
14694
-
15280
+ if (!partiallyRecomputeFor(this, dependentKey)) { return; }
14695
15281
 
14696
15282
  var dependentArray = get(this, dependentKey);
14697
15283
  if (dependentArray) {
@@ -14786,17 +15372,10 @@ ReduceComputedProperty.prototype.property = function () {
14786
15372
  } else if (match = eachPropertyPattern.exec(dependentKey)) {
14787
15373
  dependentArrayKey = match[1];
14788
15374
 
14789
- if (Ember.FEATURES.isEnabled('propertyBraceExpansion')) {
14790
- var itemPropertyKeyPattern = match[2],
14791
- addItemPropertyKey = function (itemPropertyKey) {
14792
- cp.itemPropertyKey(dependentArrayKey, itemPropertyKey);
14793
- };
14794
-
14795
- expandProperties(itemPropertyKeyPattern, addItemPropertyKey);
14796
- } else {
15375
+
14797
15376
  itemPropertyKey = match[2];
14798
15377
  cp.itemPropertyKey(dependentArrayKey, itemPropertyKey);
14799
- }
15378
+
14800
15379
  propertyArgs.add(dependentArrayKey);
14801
15380
  } else {
14802
15381
  propertyArgs.add(dependentKey);
@@ -14907,7 +15486,7 @@ ReduceComputedProperty.prototype.property = function () {
14907
15486
 
14908
15487
  ```javascript
14909
15488
  Ember.computed.max = function (dependentKey) {
14910
- return Ember.reduceComputed(dependentKey, {
15489
+ return Ember.reduceComputed.call(null, dependentKey, {
14911
15490
  initialValue: -Infinity,
14912
15491
 
14913
15492
  addedItem: function (accumulatedValue, item, changeMeta, instanceMeta) {
@@ -15057,6 +15636,11 @@ ArrayComputedProperty.prototype.resetValue = function (array) {
15057
15636
  return array;
15058
15637
  };
15059
15638
 
15639
+ // This is a stopgap to keep the reference counts correct with lazy CPs.
15640
+ ArrayComputedProperty.prototype.didChange = function (obj, keyName) {
15641
+ return;
15642
+ };
15643
+
15060
15644
  /**
15061
15645
  Creates a computed property which operates on dependent arrays and
15062
15646
  is updated with "one at a time" semantics. When items are added or
@@ -15244,7 +15828,7 @@ var get = Ember.get,
15244
15828
  @return {Ember.ComputedProperty} computes the largest value in the dependentKey's array
15245
15829
  */
15246
15830
  Ember.computed.max = function (dependentKey) {
15247
- return Ember.reduceComputed(dependentKey, {
15831
+ return Ember.reduceComputed.call(null, dependentKey, {
15248
15832
  initialValue: -Infinity,
15249
15833
 
15250
15834
  addedItem: function (accumulatedValue, item, changeMeta, instanceMeta) {
@@ -15292,7 +15876,7 @@ Ember.computed.max = function (dependentKey) {
15292
15876
  @return {Ember.ComputedProperty} computes the smallest value in the dependentKey's array
15293
15877
  */
15294
15878
  Ember.computed.min = function (dependentKey) {
15295
- return Ember.reduceComputed(dependentKey, {
15879
+ return Ember.reduceComputed.call(null, dependentKey, {
15296
15880
  initialValue: Infinity,
15297
15881
 
15298
15882
  addedItem: function (accumulatedValue, item, changeMeta, instanceMeta) {
@@ -15683,7 +16267,7 @@ Ember.computed.setDiff = function (setAProperty, setBProperty) {
15683
16267
  if (arguments.length !== 2) {
15684
16268
  throw new Ember.Error("setDiff requires exactly two dependent arrays.");
15685
16269
  }
15686
- return Ember.arrayComputed(setAProperty, setBProperty, {
16270
+ return Ember.arrayComputed.call(null, setAProperty, setBProperty, {
15687
16271
  addedItem: function (array, item, changeMeta, instanceMeta) {
15688
16272
  var setA = get(this, setAProperty),
15689
16273
  setB = get(this, setBProperty);
@@ -15885,7 +16469,7 @@ Ember.computed.sort = function (itemsKey, sortDefinition) {
15885
16469
  };
15886
16470
  }
15887
16471
 
15888
- return Ember.arrayComputed(itemsKey, {
16472
+ return Ember.arrayComputed.call(null, itemsKey, {
15889
16473
  initialize: initFn,
15890
16474
 
15891
16475
  addedItem: function (array, item, changeMeta, instanceMeta) {
@@ -15948,9 +16532,6 @@ Ember.RSVP.on('error', Ember.RSVP.onerrorDefault);
15948
16532
 
15949
16533
  var a_slice = Array.prototype.slice;
15950
16534
 
15951
- if (Ember.FEATURES.isEnabled('propertyBraceExpansion')) {
15952
- var expandProperties = Ember.expandProperties;
15953
- }
15954
16535
 
15955
16536
  if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Function) {
15956
16537
 
@@ -16047,18 +16628,9 @@ if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Function) {
16047
16628
  @for Function
16048
16629
  */
16049
16630
  Function.prototype.observes = function() {
16050
- if (Ember.FEATURES.isEnabled('propertyBraceExpansion')) {
16051
- var addWatchedProperty = function (obs) { watched.push(obs); };
16052
- var watched = [];
16053
-
16054
- for (var i=0; i<arguments.length; ++i) {
16055
- expandProperties(arguments[i], addWatchedProperty);
16056
- }
16057
-
16058
- this.__ember_observes__ = watched;
16059
- } else {
16631
+
16060
16632
  this.__ember_observes__ = a_slice.call(arguments);
16061
- }
16633
+
16062
16634
 
16063
16635
  return this;
16064
16636
  };
@@ -16121,18 +16693,9 @@ if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Function) {
16121
16693
  @for Function
16122
16694
  */
16123
16695
  Function.prototype.observesBefore = function() {
16124
- if (Ember.FEATURES.isEnabled('propertyBraceExpansion')) {
16125
- var addWatchedProperty = function (obs) { watched.push(obs); };
16126
- var watched = [];
16127
-
16128
- for (var i=0; i<arguments.length; ++i) {
16129
- expandProperties(arguments[i], addWatchedProperty);
16130
- }
16131
-
16132
- this.__ember_observesBefore__ = watched;
16133
- } else {
16696
+
16134
16697
  this.__ember_observesBefore__ = a_slice.call(arguments);
16135
- }
16698
+
16136
16699
 
16137
16700
  return this;
16138
16701
  };
@@ -16193,7 +16756,7 @@ if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Function) {
16193
16756
  @namespace Ember
16194
16757
  @since Ember 0.9
16195
16758
  */
16196
- Ember.Comparable = Ember.Mixin.create( /** @scope Ember.Comparable.prototype */{
16759
+ Ember.Comparable = Ember.Mixin.create({
16197
16760
 
16198
16761
  /**
16199
16762
  Override to return the result of the comparison of the two parameters. The
@@ -16244,7 +16807,7 @@ var get = Ember.get, set = Ember.set;
16244
16807
  @namespace Ember
16245
16808
  @since Ember 0.9
16246
16809
  */
16247
- Ember.Copyable = Ember.Mixin.create(/** @scope Ember.Copyable.prototype */ {
16810
+ Ember.Copyable = Ember.Mixin.create({
16248
16811
 
16249
16812
  /**
16250
16813
  Override to return a copy of the receiver. Default implementation raises
@@ -16348,7 +16911,7 @@ var get = Ember.get, set = Ember.set;
16348
16911
  @namespace Ember
16349
16912
  @since Ember 0.9
16350
16913
  */
16351
- Ember.Freezable = Ember.Mixin.create(/** @scope Ember.Freezable.prototype */ {
16914
+ Ember.Freezable = Ember.Mixin.create({
16352
16915
 
16353
16916
  /**
16354
16917
  Set to `true` when the object is frozen. Use this property to detect
@@ -16527,7 +17090,7 @@ var get = Ember.get, set = Ember.set;
16527
17090
  @uses Ember.Array
16528
17091
  @uses Ember.MutableEnumerable
16529
17092
  */
16530
- Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,/** @scope Ember.MutableArray.prototype */ {
17093
+ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable, {
16531
17094
 
16532
17095
  /**
16533
17096
  __Required.__ You must implement this method to apply this mixin.
@@ -17127,7 +17690,7 @@ Ember.DeferredMixin = Ember.Mixin.create({
17127
17690
  @param {Function} resolve a callback function to be called when done
17128
17691
  @param {Function} reject a callback function to be called when failed
17129
17692
  */
17130
- then: function(resolve, reject) {
17693
+ then: function(resolve, reject, label) {
17131
17694
  var deferred, promise, entity;
17132
17695
 
17133
17696
  entity = this;
@@ -17142,7 +17705,7 @@ Ember.DeferredMixin = Ember.Mixin.create({
17142
17705
  }
17143
17706
  }
17144
17707
 
17145
- return promise.then(resolve && fulfillmentHandler, reject);
17708
+ return promise.then(resolve && fulfillmentHandler, reject, label);
17146
17709
  },
17147
17710
 
17148
17711
  /**
@@ -17173,7 +17736,7 @@ Ember.DeferredMixin = Ember.Mixin.create({
17173
17736
  },
17174
17737
 
17175
17738
  _deferred: Ember.computed(function() {
17176
- return RSVP.defer();
17739
+ return RSVP.defer('Ember: DeferredMixin - ' + this);
17177
17740
  })
17178
17741
  });
17179
17742
 
@@ -17205,20 +17768,137 @@ Ember.ActionHandler = Ember.Mixin.create({
17205
17768
  mergedProperties: ['_actions'],
17206
17769
 
17207
17770
  /**
17208
- @private
17771
+ The collection of functions, keyed by name, available on this
17772
+ `ActionHandler` as action targets.
17773
+
17774
+ These functions will be invoked when a matching `{{action}}` is triggered
17775
+ from within a template and the application's current route is this route.
17776
+
17777
+ Actions can also be invoked from other parts of your application
17778
+ via `ActionHandler#send`.
17779
+
17780
+ The `actions` hash will inherit action handlers from
17781
+ the `actions` hash defined on extended parent classes
17782
+ or mixins rather than just replace the entire hash, e.g.:
17783
+
17784
+ ```js
17785
+ App.CanDisplayBanner = Ember.Mixin.create({
17786
+ actions: {
17787
+ displayBanner: function(msg) {
17788
+ // ...
17789
+ }
17790
+ }
17791
+ });
17792
+
17793
+ App.WelcomeRoute = Ember.Route.extend(App.CanDisplayBanner, {
17794
+ actions: {
17795
+ playMusic: function() {
17796
+ // ...
17797
+ }
17798
+ }
17799
+ });
17800
+
17801
+ // `WelcomeRoute`, when active, will be able to respond
17802
+ // to both actions, since the actions hash is merged rather
17803
+ // then replaced when extending mixins / parent classes.
17804
+ this.send('displayBanner');
17805
+ this.send('playMusic');
17806
+ ```
17807
+
17808
+ Within a Controller, Route, View or Component's action handler,
17809
+ the value of the `this` context is the Controller, Route, View or
17810
+ Component object:
17811
+
17812
+ ```js
17813
+ App.SongRoute = Ember.Route.extend({
17814
+ actions: {
17815
+ myAction: function() {
17816
+ this.controllerFor("song");
17817
+ this.transitionTo("other.route");
17818
+ ...
17819
+ }
17820
+ }
17821
+ });
17822
+ ```
17823
+
17824
+ It is also possible to call `this._super()` from within an
17825
+ action handler if it overrides a handler defined on a parent
17826
+ class or mixin:
17827
+
17828
+ Take for example the following routes:
17829
+
17830
+ ```js
17831
+ App.DebugRoute = Ember.Mixin.create({
17832
+ actions: {
17833
+ debugRouteInformation: function() {
17834
+ console.debug("trololo");
17835
+ }
17836
+ }
17837
+ });
17209
17838
 
17839
+ App.AnnoyingDebugRoute = Ember.Route.extend(App.DebugRoute, {
17840
+ actions: {
17841
+ debugRouteInformation: function() {
17842
+ // also call the debugRouteInformation of mixed in App.DebugRoute
17843
+ this._super();
17844
+
17845
+ // show additional annoyance
17846
+ window.alert(...);
17847
+ }
17848
+ }
17849
+ });
17850
+ ```
17851
+
17852
+ ## Bubbling
17853
+
17854
+ By default, an action will stop bubbling once a handler defined
17855
+ on the `actions` hash handles it. To continue bubbling the action,
17856
+ you must return `true` from the handler:
17857
+
17858
+ ```js
17859
+ App.Router.map(function() {
17860
+ this.resource("album", function() {
17861
+ this.route("song");
17862
+ });
17863
+ });
17864
+
17865
+ App.AlbumRoute = Ember.Route.extend({
17866
+ actions: {
17867
+ startPlaying: function() {
17868
+ }
17869
+ }
17870
+ });
17871
+
17872
+ App.AlbumSongRoute = Ember.Route.extend({
17873
+ actions: {
17874
+ startPlaying: function() {
17875
+ // ...
17876
+
17877
+ if (actionShouldAlsoBeTriggeredOnParentRoute) {
17878
+ return true;
17879
+ }
17880
+ }
17881
+ }
17882
+ });
17883
+ ```
17884
+
17885
+ @property actions
17886
+ @type Hash
17887
+ @default null
17888
+ */
17889
+
17890
+ /**
17210
17891
  Moves `actions` to `_actions` at extend time. Note that this currently
17211
17892
  modifies the mixin themselves, which is technically dubious but
17212
17893
  is practically of little consequence. This may change in the future.
17213
17894
 
17895
+ @private
17214
17896
  @method willMergeMixin
17215
17897
  */
17216
17898
  willMergeMixin: function(props) {
17217
17899
  var hashName;
17218
17900
 
17219
17901
  if (!props._actions) {
17220
- Ember.assert(this + " 'actions' should not be a function", typeof(props.actions) !== 'function');
17221
-
17222
17902
  if (typeOf(props.actions) === 'object') {
17223
17903
  hashName = 'actions';
17224
17904
  } else if (typeOf(props.events) === 'object') {
@@ -17265,6 +17945,8 @@ Ember.ActionHandler = Ember.Mixin.create({
17265
17945
 
17266
17946
  (function() {
17267
17947
  var set = Ember.set, get = Ember.get,
17948
+ resolve = Ember.RSVP.resolve,
17949
+ rethrow = Ember.RSVP.rethrow,
17268
17950
  not = Ember.computed.not,
17269
17951
  or = Ember.computed.or;
17270
17952
 
@@ -17273,16 +17955,15 @@ var set = Ember.set, get = Ember.get,
17273
17955
  @submodule ember-runtime
17274
17956
  */
17275
17957
 
17276
- function tap(proxy, promise) {
17277
- return promise.then(function(value) {
17958
+ function observePromise(proxy, promise) {
17959
+ promise.then(function(value) {
17278
17960
  set(proxy, 'isFulfilled', true);
17279
17961
  set(proxy, 'content', value);
17280
- return value;
17281
17962
  }, function(reason) {
17282
17963
  set(proxy, 'isRejected', true);
17283
17964
  set(proxy, 'reason', reason);
17284
- throw reason;
17285
- });
17965
+ // don't re-throw, as we are merely observing
17966
+ }, "Ember: PromiseProxy");
17286
17967
  }
17287
17968
 
17288
17969
  /**
@@ -17337,7 +18018,7 @@ function tap(proxy, promise) {
17337
18018
  controller.get('lastName') //=> 'Penner'
17338
18019
  ```
17339
18020
 
17340
- If the controller is backing a template, the attributes are
18021
+ If the controller is backing a template, the attributes are
17341
18022
  bindable from within that template
17342
18023
 
17343
18024
  ```handlebars
@@ -17351,26 +18032,114 @@ function tap(proxy, promise) {
17351
18032
  @class Ember.PromiseProxyMixin
17352
18033
  */
17353
18034
  Ember.PromiseProxyMixin = Ember.Mixin.create({
18035
+ /**
18036
+ If the proxied promise is rejected this will contain the reason
18037
+ provided.
18038
+
18039
+ @property reason
18040
+ @default null
18041
+ */
17354
18042
  reason: null,
18043
+
18044
+ /**
18045
+ Once the proxied promise has settled this will become `false`.
18046
+
18047
+ @property isPending
18048
+ @default true
18049
+ */
17355
18050
  isPending: not('isSettled').readOnly(),
18051
+
18052
+ /**
18053
+ Once the proxied promise has settled this will become `true`.
18054
+
18055
+ @property isSettled
18056
+ @default false
18057
+ */
17356
18058
  isSettled: or('isRejected', 'isFulfilled').readOnly(),
18059
+
18060
+ /**
18061
+ Will become `true` if the proxied promise is rejected.
18062
+
18063
+ @property isRejected
18064
+ @default false
18065
+ */
17357
18066
  isRejected: false,
18067
+
18068
+ /**
18069
+ Will become `true` if the proxied promise is fulfilled.
18070
+
18071
+ @property isFullfilled
18072
+ @default false
18073
+ */
17358
18074
  isFulfilled: false,
17359
18075
 
18076
+ /**
18077
+ The promise whose fulfillment value is being proxied by this object.
18078
+
18079
+ This property must be specified upon creation, and should not be
18080
+ changed once created.
18081
+
18082
+ Example:
18083
+
18084
+ ```javascript
18085
+ Ember.ObjectController.extend(Ember.PromiseProxyMixin).create({
18086
+ promise: <thenable>
18087
+ });
18088
+ ```
18089
+
18090
+ @property promise
18091
+ */
17360
18092
  promise: Ember.computed(function(key, promise) {
17361
18093
  if (arguments.length === 2) {
17362
- return tap(this, promise);
18094
+ promise = resolve(promise);
18095
+ observePromise(this, promise);
18096
+ return promise.then(); // fork the promise.
17363
18097
  } else {
17364
18098
  throw new Ember.Error("PromiseProxy's promise must be set");
17365
18099
  }
17366
18100
  }),
17367
18101
 
17368
- then: function(fulfill, reject) {
17369
- return get(this, 'promise').then(fulfill, reject);
17370
- }
17371
- });
18102
+ /**
18103
+ An alias to the proxied promise's `then`.
18104
+
18105
+ See RSVP.Promise.then.
18106
+
18107
+ @method then
18108
+ @param {Function} callback
18109
+ @return {RSVP.Promise}
18110
+ */
18111
+ then: promiseAlias('then'),
18112
+
18113
+ /**
18114
+ An alias to the proxied promise's `catch`.
18115
+
18116
+ See RSVP.Promise.catch.
18117
+
18118
+ @method catch
18119
+ @param {Function} callback
18120
+ @return {RSVP.Promise}
18121
+ */
18122
+ 'catch': promiseAlias('catch'),
18123
+
18124
+ /**
18125
+ An alias to the proxied promise's `finally`.
17372
18126
 
18127
+ See RSVP.Promise.finally.
17373
18128
 
18129
+ @method finally
18130
+ @param {Function} callback
18131
+ @return {RSVP.Promise}
18132
+ */
18133
+ 'finally': promiseAlias('finally')
18134
+
18135
+ });
18136
+
18137
+ function promiseAlias(name) {
18138
+ return function () {
18139
+ var promise = get(this, 'promise');
18140
+ return promise[name].apply(promise, arguments);
18141
+ };
18142
+ }
17374
18143
 
17375
18144
  })();
17376
18145
 
@@ -17493,11 +18262,12 @@ Ember.TrackedArray.prototype = {
17493
18262
  items in the array.
17494
18263
 
17495
18264
  `callback` will be called for each operation and will be passed the following arguments:
17496
- * {array} items The items for the given operation
17497
- * {number} offset The computed offset of the items, ie the index in the
17498
- array of the first item for this operation.
17499
- * {string} operation The type of the operation. One of
17500
- `Ember.TrackedArray.{RETAIN, DELETE, INSERT}`
18265
+
18266
+ * {array} items The items for the given operation
18267
+ * {number} offset The computed offset of the items, ie the index in the
18268
+ array of the first item for this operation.
18269
+ * {string} operation The type of the operation. One of
18270
+ `Ember.TrackedArray.{RETAIN, DELETE, INSERT}`
17501
18271
 
17502
18272
  @method apply
17503
18273
  @param {function} callback
@@ -17519,7 +18289,7 @@ Ember.TrackedArray.prototype = {
17519
18289
  },
17520
18290
 
17521
18291
  /**
17522
- Return an ArrayOperationMatch for the operation that contains the item at `index`.
18292
+ Return an `ArrayOperationMatch` for the operation that contains the item at `index`.
17523
18293
 
17524
18294
  @method _findArrayOperation
17525
18295
 
@@ -17681,10 +18451,10 @@ Ember.TrackedArray.prototype = {
17681
18451
 
17682
18452
  @method ArrayOperation
17683
18453
  @private
17684
- @property {string} type The type of the operation. One of
18454
+ @param {string} type The type of the operation. One of
17685
18455
  `Ember.TrackedArray.{RETAIN, INSERT, DELETE}`
17686
- @property {number} count The number of items in this operation.
17687
- @property {array} items The items of the operation, if included. RETAIN and
18456
+ @param {number} count The number of items in this operation.
18457
+ @param {array} items The items of the operation, if included. RETAIN and
17688
18458
  INSERT include their items, DELETE does not.
17689
18459
  */
17690
18460
  function ArrayOperation (operation, count, items) {
@@ -17699,11 +18469,11 @@ function ArrayOperation (operation, count, items) {
17699
18469
 
17700
18470
  @method ArrayOperationMatch
17701
18471
  @private
17702
- @property {ArrayOperation} operation
17703
- @property {number} index The index of `operation` in the array of operations.
17704
- @property {boolean} split Whether or not the item index searched for would
18472
+ @param {ArrayOperation} operation
18473
+ @param {number} index The index of `operation` in the array of operations.
18474
+ @param {boolean} split Whether or not the item index searched for would
17705
18475
  require a split for a new operation type.
17706
- @property {number} rangeStart The index of the first item in the operation,
18476
+ @param {number} rangeStart The index of the first item in the operation,
17707
18477
  with respect to the tracked array. The index of the last item can be computed
17708
18478
  from `rangeStart` and `operation.count`.
17709
18479
  */
@@ -17964,7 +18734,7 @@ var get = Ember.get, set = Ember.set;
17964
18734
  @extends Ember.Object
17965
18735
  @uses Ember.MutableArray
17966
18736
  */
17967
- Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,/** @scope Ember.ArrayProxy.prototype */ {
18737
+ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray, {
17968
18738
 
17969
18739
  /**
17970
18740
  The content array. Must be an object that implements `Ember.Array` and/or
@@ -18018,11 +18788,10 @@ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,/** @scope Ember.Array
18018
18788
  },
18019
18789
 
18020
18790
  /**
18021
- @private
18022
-
18023
18791
  Invoked when the content property is about to change. Notifies observers that the
18024
18792
  entire array content will change.
18025
18793
 
18794
+ @private
18026
18795
  @method _contentWillChange
18027
18796
  */
18028
18797
  _contentWillChange: Ember.beforeObserver('content', function() {
@@ -18044,11 +18813,10 @@ Ember.ArrayProxy = Ember.Object.extend(Ember.MutableArray,/** @scope Ember.Array
18044
18813
  contentArrayDidChange: Ember.K,
18045
18814
 
18046
18815
  /**
18047
- @private
18048
-
18049
18816
  Invoked when the content property changes. Notifies observers that the
18050
18817
  entire array content has changed.
18051
18818
 
18819
+ @private
18052
18820
  @method _contentDidChange
18053
18821
  */
18054
18822
  _contentDidChange: Ember.observer('content', function() {
@@ -18747,7 +19515,7 @@ var get = Ember.get, set = Ember.set, guidFor = Ember.guidFor, isNone = Ember.is
18747
19515
  @since Ember 0.9
18748
19516
  */
18749
19517
  Ember.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Ember.Freezable,
18750
- /** @scope Ember.Set.prototype */ {
19518
+ {
18751
19519
 
18752
19520
  // ..........................................................
18753
19521
  // IMPLEMENT ENUMERABLE APIS
@@ -19136,7 +19904,6 @@ var loaded = {};
19136
19904
  The provided `callback` will be called with the `name` passed
19137
19905
  resolved from a string into the object:
19138
19906
 
19139
-
19140
19907
  ``` javascript
19141
19908
  Ember.onLoad('Ember.Handlebars' function(hbars){
19142
19909
  hbars.registerHelper(...);
@@ -19203,6 +19970,7 @@ var get = Ember.get;
19203
19970
 
19204
19971
  @class ControllerMixin
19205
19972
  @namespace Ember
19973
+ @uses Ember.ActionHandler
19206
19974
  */
19207
19975
  Ember.ControllerMixin = Ember.Mixin.create(Ember.ActionHandler, {
19208
19976
  /* ducktype as a controller */