ember-source 1.3.0.beta.2 → 1.3.0.beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ember-source might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/dist/ember-data-deps.js +1080 -432
- data/dist/ember-data-deps.min.js +5 -5
- data/dist/ember-data-deps.prod.js +1079 -431
- data/dist/ember-debug.js +1 -1
- data/dist/ember-runtime.js +1080 -432
- data/dist/ember-runtime.min.js +5 -5
- data/dist/ember-runtime.prod.js +1079 -431
- data/dist/ember-spade.js +30 -14
- data/dist/ember-template-compiler.js +3 -3
- data/dist/ember-template-compiler.min.js +2 -2
- data/dist/ember-template-compiler.prod.js +3 -3
- data/dist/ember-tests.js +2 -2
- data/dist/ember.js +1264 -571
- data/dist/ember.min.js +9 -9
- data/dist/ember.prod.js +1260 -555
- metadata +2 -2
data/dist/ember-debug.js
CHANGED
@@ -10,7 +10,7 @@ var Ember = { assert: function() {}, FEATURES: { isEnabled: function() {} } };
|
|
10
10
|
// ==========================================================================
|
11
11
|
|
12
12
|
|
13
|
-
// Version: 1.3.0-beta.
|
13
|
+
// Version: 1.3.0-beta.3
|
14
14
|
|
15
15
|
(function() {
|
16
16
|
/*global __fail__*/
|
data/dist/ember-runtime.js
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
// ==========================================================================
|
9
9
|
|
10
10
|
|
11
|
-
// Version: 1.3.0-beta.
|
11
|
+
// Version: 1.3.0-beta.3
|
12
12
|
|
13
13
|
(function() {
|
14
14
|
/*global __fail__*/
|
@@ -194,10 +194,10 @@ if (!Ember.testing) {
|
|
194
194
|
// ==========================================================================
|
195
195
|
|
196
196
|
|
197
|
-
// Version: 1.3.0-beta.
|
197
|
+
// Version: 1.3.0-beta.3
|
198
198
|
|
199
199
|
(function() {
|
200
|
-
var define, requireModule;
|
200
|
+
var define, requireModule, require, requirejs;
|
201
201
|
|
202
202
|
(function() {
|
203
203
|
var registry = {}, seen = {};
|
@@ -206,32 +206,48 @@ var define, requireModule;
|
|
206
206
|
registry[name] = { deps: deps, callback: callback };
|
207
207
|
};
|
208
208
|
|
209
|
-
requireModule = function(name) {
|
209
|
+
requirejs = require = requireModule = function(name) {
|
210
|
+
requirejs._eak_seen = registry;
|
211
|
+
|
210
212
|
if (seen[name]) { return seen[name]; }
|
211
213
|
seen[name] = {};
|
212
214
|
|
213
|
-
|
214
|
-
|
215
|
-
mod = registry[name];
|
216
|
-
|
217
|
-
if (!mod) {
|
218
|
-
throw new Error("Module '" + name + "' not found.");
|
215
|
+
if (!registry[name]) {
|
216
|
+
throw new Error("Could not find module " + name);
|
219
217
|
}
|
220
218
|
|
221
|
-
|
222
|
-
|
223
|
-
|
219
|
+
var mod = registry[name],
|
220
|
+
deps = mod.deps,
|
221
|
+
callback = mod.callback,
|
222
|
+
reified = [],
|
223
|
+
exports;
|
224
224
|
|
225
225
|
for (var i=0, l=deps.length; i<l; i++) {
|
226
226
|
if (deps[i] === 'exports') {
|
227
227
|
reified.push(exports = {});
|
228
228
|
} else {
|
229
|
-
reified.push(requireModule(deps[i]));
|
229
|
+
reified.push(requireModule(resolve(deps[i])));
|
230
230
|
}
|
231
231
|
}
|
232
232
|
|
233
233
|
var value = callback.apply(this, reified);
|
234
234
|
return seen[name] = exports || value;
|
235
|
+
|
236
|
+
function resolve(child) {
|
237
|
+
if (child.charAt(0) !== '.') { return child; }
|
238
|
+
var parts = child.split("/");
|
239
|
+
var parentBase = name.split("/").slice(0, -1);
|
240
|
+
|
241
|
+
for (var i=0, l=parts.length; i<l; i++) {
|
242
|
+
var part = parts[i];
|
243
|
+
|
244
|
+
if (part === '..') { parentBase.pop(); }
|
245
|
+
else if (part === '.') { continue; }
|
246
|
+
else { parentBase.push(part); }
|
247
|
+
}
|
248
|
+
|
249
|
+
return parentBase.join("/");
|
250
|
+
}
|
235
251
|
};
|
236
252
|
})();
|
237
253
|
(function() {
|
@@ -259,7 +275,7 @@ var define, requireModule;
|
|
259
275
|
|
260
276
|
@class Ember
|
261
277
|
@static
|
262
|
-
@version 1.3.0-beta.
|
278
|
+
@version 1.3.0-beta.3
|
263
279
|
*/
|
264
280
|
|
265
281
|
if ('undefined' === typeof Ember) {
|
@@ -286,10 +302,10 @@ Ember.toString = function() { return "Ember"; };
|
|
286
302
|
/**
|
287
303
|
@property VERSION
|
288
304
|
@type String
|
289
|
-
@default '1.3.0-beta.
|
305
|
+
@default '1.3.0-beta.3'
|
290
306
|
@final
|
291
307
|
*/
|
292
|
-
Ember.VERSION = '1.3.0-beta.
|
308
|
+
Ember.VERSION = '1.3.0-beta.3';
|
293
309
|
|
294
310
|
/**
|
295
311
|
Standard environmental variables. You can define these in a global `ENV`
|
@@ -795,6 +811,16 @@ var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'n
|
|
795
811
|
Ember.Error = function() {
|
796
812
|
var tmp = Error.apply(this, arguments);
|
797
813
|
|
814
|
+
// Adds a `stack` property to the given error object that will yield the
|
815
|
+
// stack trace at the time captureStackTrace was called.
|
816
|
+
// When collecting the stack trace all frames above the topmost call
|
817
|
+
// to this function, including that call, will be left out of the
|
818
|
+
// stack trace.
|
819
|
+
// This is useful because we can hide Ember implementation details
|
820
|
+
// that are not very helpful for the user.
|
821
|
+
if (Error.captureStackTrace) {
|
822
|
+
Error.captureStackTrace(this, Ember.Error);
|
823
|
+
}
|
798
824
|
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
|
799
825
|
for (var idx = 0; idx < errorProps.length; idx++) {
|
800
826
|
this[errorProps[idx]] = tmp[errorProps[idx]];
|
@@ -2199,7 +2225,7 @@ function suspendListener(obj, eventName, target, method, callback) {
|
|
2199
2225
|
|
2200
2226
|
Suspends multiple listeners during a callback.
|
2201
2227
|
|
2202
|
-
|
2228
|
+
|
2203
2229
|
@method suspendListeners
|
2204
2230
|
@for Ember
|
2205
2231
|
@param obj
|
@@ -2267,7 +2293,7 @@ function watchedEvents(obj) {
|
|
2267
2293
|
is skipped, and once listeners are removed. A listener without
|
2268
2294
|
a target is executed on the passed object. If an array of actions
|
2269
2295
|
is not passed, the actions stored on the passed object are invoked.
|
2270
|
-
|
2296
|
+
|
2271
2297
|
@method sendEvent
|
2272
2298
|
@for Ember
|
2273
2299
|
@param obj
|
@@ -2346,13 +2372,16 @@ function listenersFor(obj, eventName) {
|
|
2346
2372
|
Define a property as a function that should be executed when
|
2347
2373
|
a specified event or events are triggered.
|
2348
2374
|
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
|
2355
|
-
|
2375
|
+
|
2376
|
+
``` javascript
|
2377
|
+
var Job = Ember.Object.extend({
|
2378
|
+
logCompleted: Ember.on('completed', function(){
|
2379
|
+
console.log('Job completed!');
|
2380
|
+
})
|
2381
|
+
});
|
2382
|
+
var job = Job.create();
|
2383
|
+
Ember.sendEvent(job, 'completed'); // Logs "Job completed!"
|
2384
|
+
```
|
2356
2385
|
|
2357
2386
|
@method on
|
2358
2387
|
@for Ember
|
@@ -2791,7 +2820,7 @@ function setPath(root, path, value, tolerant) {
|
|
2791
2820
|
keyName = path.slice(path.lastIndexOf('.') + 1);
|
2792
2821
|
|
2793
2822
|
// get the first part of the part
|
2794
|
-
path = path.slice(0, path.length-(keyName.length+1));
|
2823
|
+
path = (path === keyName) ? keyName : path.slice(0, path.length-(keyName.length+1));
|
2795
2824
|
|
2796
2825
|
// unless the path is this, look up the first part to
|
2797
2826
|
// get the root
|
@@ -2800,12 +2829,12 @@ function setPath(root, path, value, tolerant) {
|
|
2800
2829
|
}
|
2801
2830
|
|
2802
2831
|
if (!keyName || keyName.length === 0) {
|
2803
|
-
throw new Ember.Error('You passed an empty path');
|
2832
|
+
throw new Ember.Error('Property set failed: You passed an empty path');
|
2804
2833
|
}
|
2805
2834
|
|
2806
2835
|
if (!root) {
|
2807
2836
|
if (tolerant) { return; }
|
2808
|
-
else { throw new Ember.Error('
|
2837
|
+
else { throw new Ember.Error('Property set failed: object in path "'+path+'" could not be found or was destroyed.'); }
|
2809
2838
|
}
|
2810
2839
|
|
2811
2840
|
return set(root, keyName, value);
|
@@ -3215,7 +3244,7 @@ MapWithDefault.prototype.copy = function() {
|
|
3215
3244
|
|
3216
3245
|
(function() {
|
3217
3246
|
function consoleMethod(name) {
|
3218
|
-
var consoleObj;
|
3247
|
+
var consoleObj, logToConsole;
|
3219
3248
|
if (Ember.imports.console) {
|
3220
3249
|
consoleObj = Ember.imports.console;
|
3221
3250
|
} else if (typeof console !== 'undefined') {
|
@@ -3227,9 +3256,11 @@ function consoleMethod(name) {
|
|
3227
3256
|
if (method) {
|
3228
3257
|
// Older IE doesn't support apply, but Chrome needs it
|
3229
3258
|
if (method.apply) {
|
3230
|
-
|
3259
|
+
logToConsole = function() {
|
3231
3260
|
method.apply(consoleObj, arguments);
|
3232
3261
|
};
|
3262
|
+
logToConsole.displayName = 'console.' + name;
|
3263
|
+
return logToConsole;
|
3233
3264
|
} else {
|
3234
3265
|
return function() {
|
3235
3266
|
var message = Array.prototype.join.call(arguments, ', ');
|
@@ -3274,6 +3305,7 @@ Ember.Logger = {
|
|
3274
3305
|
@param {*} arguments
|
3275
3306
|
*/
|
3276
3307
|
log: consoleMethod('log') || Ember.K,
|
3308
|
+
|
3277
3309
|
/**
|
3278
3310
|
Prints the arguments to the console with a warning icon.
|
3279
3311
|
You can pass as many arguments as you want and they will be joined together with a space.
|
@@ -3287,8 +3319,9 @@ Ember.Logger = {
|
|
3287
3319
|
@param {*} arguments
|
3288
3320
|
*/
|
3289
3321
|
warn: consoleMethod('warn') || Ember.K,
|
3322
|
+
|
3290
3323
|
/**
|
3291
|
-
Prints the arguments to the console with an error icon, red text and a stack
|
3324
|
+
Prints the arguments to the console with an error icon, red text and a stack trace.
|
3292
3325
|
You can pass as many arguments as you want and they will be joined together with a space.
|
3293
3326
|
|
3294
3327
|
```javascript
|
@@ -3300,6 +3333,7 @@ Ember.Logger = {
|
|
3300
3333
|
@param {*} arguments
|
3301
3334
|
*/
|
3302
3335
|
error: consoleMethod('error') || Ember.K,
|
3336
|
+
|
3303
3337
|
/**
|
3304
3338
|
Logs the arguments to the console.
|
3305
3339
|
You can pass as many arguments as you want and they will be joined together with a space.
|
@@ -3314,6 +3348,7 @@ Ember.Logger = {
|
|
3314
3348
|
@param {*} arguments
|
3315
3349
|
*/
|
3316
3350
|
info: consoleMethod('info') || Ember.K,
|
3351
|
+
|
3317
3352
|
/**
|
3318
3353
|
Logs the arguments to the console in blue text.
|
3319
3354
|
You can pass as many arguments as you want and they will be joined together with a space.
|
@@ -3328,9 +3363,9 @@ Ember.Logger = {
|
|
3328
3363
|
@param {*} arguments
|
3329
3364
|
*/
|
3330
3365
|
debug: consoleMethod('debug') || consoleMethod('info') || Ember.K,
|
3331
|
-
/**
|
3332
3366
|
|
3333
|
-
|
3367
|
+
/**
|
3368
|
+
If the value passed into `Ember.Logger.assert` is not truthy it will throw an error with a stack trace.
|
3334
3369
|
|
3335
3370
|
```javascript
|
3336
3371
|
Ember.Logger.assert(true); // undefined
|
@@ -4375,11 +4410,11 @@ ComputedPropertyPrototype.cacheable = function(aFlag) {
|
|
4375
4410
|
mode the computed property will not automatically cache the return value.
|
4376
4411
|
|
4377
4412
|
```javascript
|
4378
|
-
MyApp.outsideService = Ember.Object.
|
4413
|
+
MyApp.outsideService = Ember.Object.extend({
|
4379
4414
|
value: function() {
|
4380
4415
|
return OutsideService.getValue();
|
4381
4416
|
}.property().volatile()
|
4382
|
-
});
|
4417
|
+
}).create();
|
4383
4418
|
```
|
4384
4419
|
|
4385
4420
|
@method volatile
|
@@ -4395,12 +4430,14 @@ ComputedPropertyPrototype.volatile = function() {
|
|
4395
4430
|
mode the computed property will throw an error when set.
|
4396
4431
|
|
4397
4432
|
```javascript
|
4398
|
-
MyApp.
|
4433
|
+
MyApp.Person = Ember.Object.extend({
|
4399
4434
|
guid: function() {
|
4400
4435
|
return 'guid-guid-guid';
|
4401
4436
|
}.property().readOnly()
|
4402
4437
|
});
|
4403
4438
|
|
4439
|
+
MyApp.person = MyApp.Person.create();
|
4440
|
+
|
4404
4441
|
MyApp.person.set('guid', 'new-guid'); // will throw an exception
|
4405
4442
|
```
|
4406
4443
|
|
@@ -4418,7 +4455,7 @@ ComputedPropertyPrototype.readOnly = function(readOnly) {
|
|
4418
4455
|
arguments containing key paths that this computed property depends on.
|
4419
4456
|
|
4420
4457
|
```javascript
|
4421
|
-
MyApp.
|
4458
|
+
MyApp.President = Ember.Object.extend({
|
4422
4459
|
fullName: Ember.computed(function() {
|
4423
4460
|
return this.get('firstName') + ' ' + this.get('lastName');
|
4424
4461
|
|
@@ -4426,6 +4463,12 @@ ComputedPropertyPrototype.readOnly = function(readOnly) {
|
|
4426
4463
|
// and lastName
|
4427
4464
|
}).property('firstName', 'lastName')
|
4428
4465
|
});
|
4466
|
+
|
4467
|
+
MyApp.president = MyApp.President.create({
|
4468
|
+
firstName: 'Barack',
|
4469
|
+
lastName: 'Obama',
|
4470
|
+
});
|
4471
|
+
MyApp.president.get('fullName'); // Barack Obama
|
4429
4472
|
```
|
4430
4473
|
|
4431
4474
|
@method property
|
@@ -6114,6 +6157,7 @@ Ember.run = function(target, method) {
|
|
6114
6157
|
|
6115
6158
|
If invoked when not within a run loop:
|
6116
6159
|
|
6160
|
+
|
6117
6161
|
```javascript
|
6118
6162
|
Ember.run.join(function() {
|
6119
6163
|
// creates a new run-loop
|
@@ -6122,6 +6166,7 @@ Ember.run = function(target, method) {
|
|
6122
6166
|
|
6123
6167
|
Alternatively, if called within an existing run loop:
|
6124
6168
|
|
6169
|
+
|
6125
6170
|
```javascript
|
6126
6171
|
Ember.run(function() {
|
6127
6172
|
// creates a new run-loop
|
@@ -7888,16 +7933,67 @@ Ember Metal
|
|
7888
7933
|
})();
|
7889
7934
|
|
7890
7935
|
(function() {
|
7936
|
+
/**
|
7937
|
+
@class RSVP
|
7938
|
+
@module RSVP
|
7939
|
+
*/
|
7891
7940
|
define("rsvp/all",
|
7892
|
-
["
|
7893
|
-
function(__dependency1__, __exports__) {
|
7941
|
+
["./promise","./utils","exports"],
|
7942
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
7894
7943
|
"use strict";
|
7895
|
-
var Promise = __dependency1__.Promise;
|
7896
7944
|
/* global toString */
|
7897
7945
|
|
7946
|
+
var Promise = __dependency1__.Promise;
|
7947
|
+
var isArray = __dependency2__.isArray;
|
7948
|
+
var isFunction = __dependency2__.isFunction;
|
7949
|
+
|
7950
|
+
/**
|
7951
|
+
Returns a promise that is fulfilled when all the given promises have been
|
7952
|
+
fulfilled, or rejected if any of them become rejected. The return promise
|
7953
|
+
is fulfilled with an array that gives all the values in the order they were
|
7954
|
+
passed in the `promises` array argument.
|
7955
|
+
|
7956
|
+
Example:
|
7957
|
+
|
7958
|
+
```javascript
|
7959
|
+
var promise1 = RSVP.resolve(1);
|
7960
|
+
var promise2 = RSVP.resolve(2);
|
7961
|
+
var promise3 = RSVP.resolve(3);
|
7962
|
+
var promises = [ promise1, promise2, promise3 ];
|
7963
|
+
|
7964
|
+
RSVP.all(promises).then(function(array){
|
7965
|
+
// The array here would be [ 1, 2, 3 ];
|
7966
|
+
});
|
7967
|
+
```
|
7968
|
+
|
7969
|
+
If any of the `promises` given to `RSVP.all` are rejected, the first promise
|
7970
|
+
that is rejected will be given as an argument to the returned promises's
|
7971
|
+
rejection handler. For example:
|
7972
|
+
|
7973
|
+
Example:
|
7898
7974
|
|
7899
|
-
|
7900
|
-
|
7975
|
+
```javascript
|
7976
|
+
var promise1 = RSVP.resolve(1);
|
7977
|
+
var promise2 = RSVP.reject(new Error("2"));
|
7978
|
+
var promise3 = RSVP.reject(new Error("3"));
|
7979
|
+
var promises = [ promise1, promise2, promise3 ];
|
7980
|
+
|
7981
|
+
RSVP.all(promises).then(function(array){
|
7982
|
+
// Code here never runs because there are rejected promises!
|
7983
|
+
}, function(error) {
|
7984
|
+
// error.message === "2"
|
7985
|
+
});
|
7986
|
+
```
|
7987
|
+
|
7988
|
+
@method all
|
7989
|
+
@for RSVP
|
7990
|
+
@param {Array} promises
|
7991
|
+
@param {String} label
|
7992
|
+
@return {Promise} promise that is fulfilled when all `promises` have been
|
7993
|
+
fulfilled, or rejected if any of them become rejected.
|
7994
|
+
*/
|
7995
|
+
function all(promises, label) {
|
7996
|
+
if (!isArray(promises)) {
|
7901
7997
|
throw new TypeError('You must pass an array to all.');
|
7902
7998
|
}
|
7903
7999
|
|
@@ -7925,102 +8021,74 @@ define("rsvp/all",
|
|
7925
8021
|
for (var i = 0; i < promises.length; i++) {
|
7926
8022
|
promise = promises[i];
|
7927
8023
|
|
7928
|
-
if (promise &&
|
7929
|
-
promise.then(resolver(i), reject);
|
8024
|
+
if (promise && isFunction(promise.then)) {
|
8025
|
+
promise.then(resolver(i), reject, "RSVP: RSVP#all");
|
7930
8026
|
} else {
|
7931
8027
|
resolveAll(i, promise);
|
7932
8028
|
}
|
7933
8029
|
}
|
7934
|
-
});
|
8030
|
+
}, label);
|
7935
8031
|
}
|
7936
8032
|
|
7937
|
-
|
7938
8033
|
__exports__.all = all;
|
7939
8034
|
});
|
7940
|
-
define("rsvp/async",
|
7941
|
-
["rsvp/config","exports"],
|
7942
|
-
function(__dependency1__, __exports__) {
|
7943
|
-
"use strict";
|
7944
|
-
var config = __dependency1__.config;
|
7945
|
-
|
7946
|
-
var browserGlobal = (typeof window !== 'undefined') ? window : {};
|
7947
|
-
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
|
7948
|
-
var local = (typeof global !== 'undefined') ? global : this;
|
7949
8035
|
|
7950
|
-
|
7951
|
-
|
7952
|
-
|
7953
|
-
|
7954
|
-
|
7955
|
-
|
7956
|
-
|
7957
|
-
function useMutationObserver() {
|
7958
|
-
var observer = new BrowserMutationObserver(flush);
|
7959
|
-
var element = document.createElement('div');
|
7960
|
-
observer.observe(element, { attributes: true });
|
8036
|
+
define("rsvp/cast",
|
8037
|
+
["exports"],
|
8038
|
+
function(__exports__) {
|
8039
|
+
"use strict";
|
8040
|
+
/**
|
8041
|
+
`RSVP.Promise.cast` returns the same promise if that promise shares a constructor
|
8042
|
+
with the promise being casted.
|
7961
8043
|
|
7962
|
-
|
7963
|
-
window.addEventListener('unload', function(){
|
7964
|
-
observer.disconnect();
|
7965
|
-
observer = null;
|
7966
|
-
}, false);
|
8044
|
+
Example:
|
7967
8045
|
|
7968
|
-
|
7969
|
-
|
7970
|
-
|
7971
|
-
}
|
8046
|
+
```javascript
|
8047
|
+
var promise = RSVP.resolve(1);
|
8048
|
+
var casted = RSVP.Promise.cast(promise);
|
7972
8049
|
|
7973
|
-
|
7974
|
-
|
7975
|
-
local.setTimeout(flush, 1);
|
7976
|
-
};
|
7977
|
-
}
|
8050
|
+
console.log(promise === casted); // true
|
8051
|
+
```
|
7978
8052
|
|
7979
|
-
|
7980
|
-
|
7981
|
-
|
7982
|
-
var tuple = queue[i];
|
7983
|
-
var callback = tuple[0], arg = tuple[1];
|
7984
|
-
callback(arg);
|
7985
|
-
}
|
7986
|
-
queue = [];
|
7987
|
-
}
|
8053
|
+
In the case of a promise whose constructor does not match, it is assimilated.
|
8054
|
+
The resulting promise will fulfill or reject based on the outcome of the
|
8055
|
+
promise being casted.
|
7988
8056
|
|
7989
|
-
|
8057
|
+
In the case of a non-promise, a promise which will fulfill with that value is
|
8058
|
+
returned.
|
7990
8059
|
|
7991
|
-
|
7992
|
-
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
|
7993
|
-
scheduleFlush = useNextTick();
|
7994
|
-
} else if (BrowserMutationObserver) {
|
7995
|
-
scheduleFlush = useMutationObserver();
|
7996
|
-
} else {
|
7997
|
-
scheduleFlush = useSetTimeout();
|
7998
|
-
}
|
8060
|
+
Example:
|
7999
8061
|
|
8000
|
-
|
8001
|
-
var
|
8002
|
-
|
8003
|
-
// If length is 1, that means that we need to schedule an async flush.
|
8004
|
-
// If additional callbacks are queued before the queue is flushed, they
|
8005
|
-
// will be processed by this flush that we are scheduling.
|
8006
|
-
scheduleFlush();
|
8007
|
-
}
|
8008
|
-
}
|
8062
|
+
```javascript
|
8063
|
+
var value = 1; // could be a number, boolean, string, undefined...
|
8064
|
+
var casted = RSVP.Promise.cast(value);
|
8009
8065
|
|
8010
|
-
|
8066
|
+
console.log(value === casted); // false
|
8067
|
+
console.log(casted instanceof RSVP.Promise) // true
|
8011
8068
|
|
8012
|
-
|
8013
|
-
|
8014
|
-
|
8069
|
+
casted.then(function(val) {
|
8070
|
+
val === value // => true
|
8071
|
+
});
|
8072
|
+
```
|
8073
|
+
|
8074
|
+
`RSVP.Promise.cast` is similar to `RSVP.resolve`, but `RSVP.Promise.cast` differs in the
|
8075
|
+
following ways:
|
8076
|
+
* `RSVP.Promise.cast` serves as a memory-efficient way of getting a promise, when you
|
8077
|
+
have something that could either be a promise or a value. RSVP.resolve
|
8078
|
+
will have the same effect but will create a new promise wrapper if the
|
8079
|
+
argument is a promise.
|
8080
|
+
* `RSVP.Promise.cast` is a way of casting incoming thenables or promise subclasses to
|
8081
|
+
promises of the exact class specified, so that the resulting object's `then` is
|
8082
|
+
ensured to have the behavior of the constructor you are calling cast on (i.e., RSVP.Promise).
|
8083
|
+
|
8084
|
+
@method cast
|
8085
|
+
@for RSVP
|
8086
|
+
@param {Object} object to be casted
|
8087
|
+
@return {Promise} promise that is fulfilled when all properties of `promises`
|
8088
|
+
have been fulfilled, or rejected if any of them become rejected.
|
8089
|
+
*/
|
8015
8090
|
|
8016
8091
|
|
8017
|
-
__exports__.async = async;
|
8018
|
-
__exports__.asyncDefault = asyncDefault;
|
8019
|
-
});
|
8020
|
-
define("rsvp/cast",
|
8021
|
-
["exports"],
|
8022
|
-
function(__exports__) {
|
8023
|
-
"use strict";
|
8024
8092
|
function cast(object) {
|
8025
8093
|
/*jshint validthis:true */
|
8026
8094
|
if (object && typeof object === 'object' && object.constructor === this) {
|
@@ -8034,16 +8102,18 @@ define("rsvp/cast",
|
|
8034
8102
|
});
|
8035
8103
|
}
|
8036
8104
|
|
8037
|
-
|
8038
8105
|
__exports__.cast = cast;
|
8039
8106
|
});
|
8040
8107
|
define("rsvp/config",
|
8041
|
-
["
|
8108
|
+
["./events","exports"],
|
8042
8109
|
function(__dependency1__, __exports__) {
|
8043
8110
|
"use strict";
|
8044
8111
|
var EventTarget = __dependency1__.EventTarget;
|
8045
8112
|
|
8046
|
-
var config = {
|
8113
|
+
var config = {
|
8114
|
+
instrument: false
|
8115
|
+
};
|
8116
|
+
|
8047
8117
|
EventTarget.mixin(config);
|
8048
8118
|
|
8049
8119
|
function configure(name, value) {
|
@@ -8051,40 +8121,58 @@ define("rsvp/config",
|
|
8051
8121
|
// handle for legacy users that expect the actual
|
8052
8122
|
// error to be passed to their function added via
|
8053
8123
|
// `RSVP.configure('onerror', someFunctionHere);`
|
8054
|
-
config.on('error',
|
8055
|
-
|
8056
|
-
});
|
8057
|
-
} else {
|
8058
|
-
config[name] = value;
|
8124
|
+
config.on('error', value);
|
8125
|
+
return;
|
8059
8126
|
}
|
8060
|
-
}
|
8061
|
-
|
8062
|
-
function on(){
|
8063
|
-
return config.on.apply(config, arguments);
|
8064
|
-
}
|
8065
|
-
|
8066
|
-
function off(){
|
8067
|
-
return config.off.apply(config, arguments);
|
8068
|
-
}
|
8069
8127
|
|
8070
|
-
|
8071
|
-
|
8128
|
+
if (arguments.length === 2) {
|
8129
|
+
config[name] = value;
|
8130
|
+
} else {
|
8131
|
+
return config[name];
|
8132
|
+
}
|
8072
8133
|
}
|
8073
8134
|
|
8074
|
-
|
8075
8135
|
__exports__.config = config;
|
8076
8136
|
__exports__.configure = configure;
|
8077
|
-
__exports__.on = on;
|
8078
|
-
__exports__.off = off;
|
8079
|
-
__exports__.trigger = trigger;
|
8080
8137
|
});
|
8081
8138
|
define("rsvp/defer",
|
8082
|
-
["
|
8139
|
+
["./promise","exports"],
|
8083
8140
|
function(__dependency1__, __exports__) {
|
8084
8141
|
"use strict";
|
8085
8142
|
var Promise = __dependency1__.Promise;
|
8086
8143
|
|
8087
|
-
|
8144
|
+
/**
|
8145
|
+
`RSVP.defer` returns an object similar to jQuery's `$.Deferred` objects.
|
8146
|
+
`RSVP.defer` should be used when porting over code reliant on `$.Deferred`'s
|
8147
|
+
interface. New code should use the `RSVP.Promise` constructor instead.
|
8148
|
+
|
8149
|
+
The object returned from `RSVP.defer` is a plain object with three properties:
|
8150
|
+
|
8151
|
+
* promise - an `RSVP.Promise`.
|
8152
|
+
* reject - a function that causes the `promise` property on this object to
|
8153
|
+
become rejected
|
8154
|
+
* resolve - a function that causes the `promise` property on this object to
|
8155
|
+
become fulfilled.
|
8156
|
+
|
8157
|
+
Example:
|
8158
|
+
|
8159
|
+
```javascript
|
8160
|
+
var deferred = RSVP.defer();
|
8161
|
+
|
8162
|
+
deferred.resolve("Success!");
|
8163
|
+
|
8164
|
+
defered.promise.then(function(value){
|
8165
|
+
// value here is "Success!"
|
8166
|
+
});
|
8167
|
+
```
|
8168
|
+
|
8169
|
+
@method defer
|
8170
|
+
@for RSVP
|
8171
|
+
@param {String} -
|
8172
|
+
@return {Object}
|
8173
|
+
*/
|
8174
|
+
|
8175
|
+
function defer(label) {
|
8088
8176
|
var deferred = {
|
8089
8177
|
// pre-allocate shape
|
8090
8178
|
resolve: undefined,
|
@@ -8095,31 +8183,20 @@ define("rsvp/defer",
|
|
8095
8183
|
deferred.promise = new Promise(function(resolve, reject) {
|
8096
8184
|
deferred.resolve = resolve;
|
8097
8185
|
deferred.reject = reject;
|
8098
|
-
});
|
8186
|
+
}, label);
|
8099
8187
|
|
8100
8188
|
return deferred;
|
8101
8189
|
}
|
8102
8190
|
|
8103
|
-
|
8104
8191
|
__exports__.defer = defer;
|
8105
8192
|
});
|
8106
8193
|
define("rsvp/events",
|
8107
8194
|
["exports"],
|
8108
8195
|
function(__exports__) {
|
8109
8196
|
"use strict";
|
8110
|
-
var Event = function(type, options) {
|
8111
|
-
this.type = type;
|
8112
|
-
|
8113
|
-
for (var option in options) {
|
8114
|
-
if (!options.hasOwnProperty(option)) { continue; }
|
8115
|
-
|
8116
|
-
this[option] = options[option];
|
8117
|
-
}
|
8118
|
-
};
|
8119
|
-
|
8120
8197
|
var indexOf = function(callbacks, callback) {
|
8121
8198
|
for (var i=0, l=callbacks.length; i<l; i++) {
|
8122
|
-
if (callbacks[i]
|
8199
|
+
if (callbacks[i] === callback) { return i; }
|
8123
8200
|
}
|
8124
8201
|
|
8125
8202
|
return -1;
|
@@ -8135,214 +8212,523 @@ define("rsvp/events",
|
|
8135
8212
|
return callbacks;
|
8136
8213
|
};
|
8137
8214
|
|
8215
|
+
/**
|
8216
|
+
//@module RSVP
|
8217
|
+
//@class EventTarget
|
8218
|
+
*/
|
8138
8219
|
var EventTarget = {
|
8220
|
+
|
8221
|
+
/**
|
8222
|
+
@private
|
8223
|
+
`RSVP.EventTarget.mixin` extends an object with EventTarget methods. For
|
8224
|
+
Example:
|
8225
|
+
|
8226
|
+
```javascript
|
8227
|
+
var object = {};
|
8228
|
+
|
8229
|
+
RSVP.EventTarget.mixin(object);
|
8230
|
+
|
8231
|
+
object.on("finished", function(event) {
|
8232
|
+
// handle event
|
8233
|
+
});
|
8234
|
+
|
8235
|
+
object.trigger("finished", { detail: value });
|
8236
|
+
```
|
8237
|
+
|
8238
|
+
`EventTarget.mixin` also works with prototypes:
|
8239
|
+
|
8240
|
+
```javascript
|
8241
|
+
var Person = function() {};
|
8242
|
+
RSVP.EventTarget.mixin(Person.prototype);
|
8243
|
+
|
8244
|
+
var yehuda = new Person();
|
8245
|
+
var tom = new Person();
|
8246
|
+
|
8247
|
+
yehuda.on("poke", function(event) {
|
8248
|
+
console.log("Yehuda says OW");
|
8249
|
+
});
|
8250
|
+
|
8251
|
+
tom.on("poke", function(event) {
|
8252
|
+
console.log("Tom says OW");
|
8253
|
+
});
|
8254
|
+
|
8255
|
+
yehuda.trigger("poke");
|
8256
|
+
tom.trigger("poke");
|
8257
|
+
```
|
8258
|
+
|
8259
|
+
@method mixin
|
8260
|
+
@param {Object} object object to extend with EventTarget methods
|
8261
|
+
*/
|
8139
8262
|
mixin: function(object) {
|
8140
8263
|
object.on = this.on;
|
8141
8264
|
object.off = this.off;
|
8142
8265
|
object.trigger = this.trigger;
|
8266
|
+
object._promiseCallbacks = undefined;
|
8143
8267
|
return object;
|
8144
8268
|
},
|
8145
8269
|
|
8146
|
-
|
8147
|
-
|
8148
|
-
eventNames = eventNames.split(/\s+/);
|
8149
|
-
binding = binding || this;
|
8270
|
+
/**
|
8271
|
+
@private
|
8150
8272
|
|
8151
|
-
|
8152
|
-
callbacks = allCallbacks[eventName];
|
8273
|
+
Registers a callback to be executed when `eventName` is triggered
|
8153
8274
|
|
8154
|
-
|
8155
|
-
|
8156
|
-
|
8275
|
+
```javascript
|
8276
|
+
object.on('event', function(eventInfo){
|
8277
|
+
// handle the event
|
8278
|
+
});
|
8157
8279
|
|
8158
|
-
|
8159
|
-
|
8160
|
-
|
8280
|
+
object.trigger('event');
|
8281
|
+
```
|
8282
|
+
|
8283
|
+
@method on
|
8284
|
+
@param {String} eventName name of the event to listen for
|
8285
|
+
@param {Function} callback function to be called when the event is triggered.
|
8286
|
+
*/
|
8287
|
+
on: function(eventName, callback) {
|
8288
|
+
var allCallbacks = callbacksFor(this), callbacks;
|
8289
|
+
|
8290
|
+
callbacks = allCallbacks[eventName];
|
8291
|
+
|
8292
|
+
if (!callbacks) {
|
8293
|
+
callbacks = allCallbacks[eventName] = [];
|
8294
|
+
}
|
8295
|
+
|
8296
|
+
if (indexOf(callbacks, callback) === -1) {
|
8297
|
+
callbacks.push(callback);
|
8161
8298
|
}
|
8162
8299
|
},
|
8163
8300
|
|
8164
|
-
|
8165
|
-
|
8166
|
-
eventNames = eventNames.split(/\s+/);
|
8301
|
+
/**
|
8302
|
+
@private
|
8167
8303
|
|
8168
|
-
|
8169
|
-
if (!callback) {
|
8170
|
-
allCallbacks[eventName] = [];
|
8171
|
-
continue;
|
8172
|
-
}
|
8304
|
+
You can use `off` to stop firing a particular callback for an event:
|
8173
8305
|
|
8174
|
-
|
8306
|
+
```javascript
|
8307
|
+
function doStuff() { // do stuff! }
|
8308
|
+
object.on('stuff', doStuff);
|
8175
8309
|
|
8176
|
-
|
8310
|
+
object.trigger('stuff'); // doStuff will be called
|
8177
8311
|
|
8178
|
-
|
8312
|
+
// Unregister ONLY the doStuff callback
|
8313
|
+
object.off('stuff', doStuff);
|
8314
|
+
object.trigger('stuff'); // doStuff will NOT be called
|
8315
|
+
```
|
8316
|
+
|
8317
|
+
If you don't pass a `callback` argument to `off`, ALL callbacks for the
|
8318
|
+
event will not be executed when the event fires. For example:
|
8319
|
+
|
8320
|
+
```javascript
|
8321
|
+
var callback1 = function(){};
|
8322
|
+
var callback2 = function(){};
|
8323
|
+
|
8324
|
+
object.on('stuff', callback1);
|
8325
|
+
object.on('stuff', callback2);
|
8326
|
+
|
8327
|
+
object.trigger('stuff'); // callback1 and callback2 will be executed.
|
8328
|
+
|
8329
|
+
object.off('stuff');
|
8330
|
+
object.trigger('stuff'); // callback1 and callback2 will not be executed!
|
8331
|
+
```
|
8332
|
+
|
8333
|
+
@method off
|
8334
|
+
@param {String} eventName event to stop listening to
|
8335
|
+
@param {Function} callback optional argument. If given, only the function
|
8336
|
+
given will be removed from the event's callback queue. If no `callback`
|
8337
|
+
argument is given, all callbacks will be removed from the event's callback
|
8338
|
+
queue.
|
8339
|
+
*/
|
8340
|
+
off: function(eventName, callback) {
|
8341
|
+
var allCallbacks = callbacksFor(this), callbacks, index;
|
8342
|
+
|
8343
|
+
if (!callback) {
|
8344
|
+
allCallbacks[eventName] = [];
|
8345
|
+
return;
|
8179
8346
|
}
|
8347
|
+
|
8348
|
+
callbacks = allCallbacks[eventName];
|
8349
|
+
|
8350
|
+
index = indexOf(callbacks, callback);
|
8351
|
+
|
8352
|
+
if (index !== -1) { callbacks.splice(index, 1); }
|
8180
8353
|
},
|
8181
8354
|
|
8355
|
+
/**
|
8356
|
+
@private
|
8357
|
+
|
8358
|
+
Use `trigger` to fire custom events. For example:
|
8359
|
+
|
8360
|
+
```javascript
|
8361
|
+
object.on('foo', function(){
|
8362
|
+
console.log('foo event happened!');
|
8363
|
+
});
|
8364
|
+
object.trigger('foo');
|
8365
|
+
// 'foo event happened!' logged to the console
|
8366
|
+
```
|
8367
|
+
|
8368
|
+
You can also pass a value as a second argument to `trigger` that will be
|
8369
|
+
passed as an argument to all event listeners for the event:
|
8370
|
+
|
8371
|
+
```javascript
|
8372
|
+
object.on('foo', function(value){
|
8373
|
+
console.log(value.name);
|
8374
|
+
});
|
8375
|
+
|
8376
|
+
object.trigger('foo', { name: 'bar' });
|
8377
|
+
// 'bar' logged to the console
|
8378
|
+
```
|
8379
|
+
|
8380
|
+
@method trigger
|
8381
|
+
@param {String} eventName name of the event to be triggered
|
8382
|
+
@param {Any} options optional value to be passed to any event handlers for
|
8383
|
+
the given `eventName`
|
8384
|
+
*/
|
8182
8385
|
trigger: function(eventName, options) {
|
8183
8386
|
var allCallbacks = callbacksFor(this),
|
8184
|
-
callbacks, callbackTuple, callback, binding
|
8387
|
+
callbacks, callbackTuple, callback, binding;
|
8185
8388
|
|
8186
8389
|
if (callbacks = allCallbacks[eventName]) {
|
8187
8390
|
// Don't cache the callbacks.length since it may grow
|
8188
8391
|
for (var i=0; i<callbacks.length; i++) {
|
8189
|
-
|
8190
|
-
callback = callbackTuple[0];
|
8191
|
-
binding = callbackTuple[1];
|
8392
|
+
callback = callbacks[i];
|
8192
8393
|
|
8193
|
-
|
8194
|
-
options = { detail: options };
|
8195
|
-
}
|
8196
|
-
|
8197
|
-
event = new Event(eventName, options);
|
8198
|
-
callback.call(binding, event);
|
8394
|
+
callback(options);
|
8199
8395
|
}
|
8200
8396
|
}
|
8201
8397
|
}
|
8202
8398
|
};
|
8203
8399
|
|
8204
|
-
|
8205
8400
|
__exports__.EventTarget = EventTarget;
|
8206
8401
|
});
|
8207
8402
|
define("rsvp/hash",
|
8208
|
-
["
|
8209
|
-
function(__dependency1__, __exports__) {
|
8403
|
+
["./promise","./utils","exports"],
|
8404
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
8210
8405
|
"use strict";
|
8211
|
-
var
|
8406
|
+
var Promise = __dependency1__.Promise;
|
8407
|
+
var isFunction = __dependency2__.isFunction;
|
8212
8408
|
|
8213
|
-
function
|
8214
|
-
var
|
8409
|
+
var keysOf = Object.keys || function(object) {
|
8410
|
+
var result = [];
|
8215
8411
|
|
8216
8412
|
for (var prop in object) {
|
8217
|
-
|
8413
|
+
result.push(prop);
|
8218
8414
|
}
|
8219
8415
|
|
8220
|
-
return
|
8221
|
-
}
|
8416
|
+
return result;
|
8417
|
+
};
|
8222
8418
|
|
8223
|
-
|
8224
|
-
|
8419
|
+
/**
|
8420
|
+
`RSVP.hash` is similar to `RSVP.all`, but takes an object instead of an array
|
8421
|
+
for its `promises` argument.
|
8225
8422
|
|
8226
|
-
|
8227
|
-
|
8228
|
-
|
8423
|
+
Returns a promise that is fulfilled when all the given promises have been
|
8424
|
+
fulfilled, or rejected if any of them become rejected. The returned promise
|
8425
|
+
is fulfilled with a hash that has the same key names as the `promises` object
|
8426
|
+
argument. If any of the values in the object are not promises, they will
|
8427
|
+
simply be copied over to the fulfilled object.
|
8229
8428
|
|
8230
|
-
|
8231
|
-
|
8232
|
-
|
8233
|
-
|
8429
|
+
Example:
|
8430
|
+
|
8431
|
+
```javascript
|
8432
|
+
var promises = {
|
8433
|
+
myPromise: RSVP.resolve(1),
|
8434
|
+
yourPromise: RSVP.resolve(2),
|
8435
|
+
theirPromise: RSVP.resolve(3),
|
8436
|
+
notAPromise: 4
|
8234
8437
|
};
|
8235
8438
|
|
8236
|
-
|
8237
|
-
|
8238
|
-
|
8239
|
-
|
8240
|
-
|
8439
|
+
RSVP.hash(promises).then(function(hash){
|
8440
|
+
// hash here is an object that looks like:
|
8441
|
+
// {
|
8442
|
+
// myPromise: 1,
|
8443
|
+
// yourPromise: 2,
|
8444
|
+
// theirPromise: 3,
|
8445
|
+
// notAPromise: 4
|
8446
|
+
// }
|
8447
|
+
});
|
8448
|
+
````
|
8449
|
+
|
8450
|
+
If any of the `promises` given to `RSVP.hash` are rejected, the first promise
|
8451
|
+
that is rejected will be given as as the first argument, or as the reason to
|
8452
|
+
the rejection handler. For example:
|
8453
|
+
|
8454
|
+
```javascript
|
8455
|
+
var promises = {
|
8456
|
+
myPromise: RSVP.resolve(1),
|
8457
|
+
rejectedPromise: RSVP.reject(new Error("rejectedPromise")),
|
8458
|
+
anotherRejectedPromise: RSVP.reject(new Error("anotherRejectedPromise")),
|
8241
8459
|
};
|
8242
8460
|
|
8243
|
-
|
8244
|
-
|
8461
|
+
RSVP.hash(promises).then(function(hash){
|
8462
|
+
// Code here never runs because there are rejected promises!
|
8463
|
+
}, function(reason) {
|
8464
|
+
// reason.message === "rejectedPromise"
|
8465
|
+
});
|
8466
|
+
```
|
8467
|
+
|
8468
|
+
An important note: `RSVP.hash` is intended for plain JavaScript objects that
|
8469
|
+
are just a set of keys and values. `RSVP.hash` will NOT preserve prototype
|
8470
|
+
chains.
|
8471
|
+
|
8472
|
+
Example:
|
8473
|
+
|
8474
|
+
```javascript
|
8475
|
+
function MyConstructor(){
|
8476
|
+
this.example = RSVP.resolve("Example");
|
8477
|
+
}
|
8478
|
+
|
8479
|
+
MyConstructor.prototype = {
|
8480
|
+
protoProperty: RSVP.resolve("Proto Property")
|
8245
8481
|
};
|
8246
8482
|
|
8247
|
-
|
8248
|
-
|
8249
|
-
|
8250
|
-
|
8251
|
-
|
8483
|
+
var myObject = new MyConstructor();
|
8484
|
+
|
8485
|
+
RSVP.hash(myObject).then(function(hash){
|
8486
|
+
// protoProperty will not be present, instead you will just have an
|
8487
|
+
// object that looks like:
|
8488
|
+
// {
|
8489
|
+
// example: "Example"
|
8490
|
+
// }
|
8491
|
+
//
|
8492
|
+
// hash.hasOwnProperty('protoProperty'); // false
|
8493
|
+
// 'undefined' === typeof hash.protoProperty
|
8494
|
+
});
|
8495
|
+
```
|
8496
|
+
|
8497
|
+
@method hash
|
8498
|
+
@for RSVP
|
8499
|
+
@param {Object} promises
|
8500
|
+
@param {String} label - optional string that describes the promise.
|
8501
|
+
Useful for tooling.
|
8502
|
+
@return {Promise} promise that is fulfilled when all properties of `promises`
|
8503
|
+
have been fulfilled, or rejected if any of them become rejected.
|
8504
|
+
*/
|
8505
|
+
function hash(object, label) {
|
8506
|
+
var results = {},
|
8507
|
+
keys = keysOf(object),
|
8508
|
+
remaining = keys.length;
|
8509
|
+
|
8510
|
+
return new Promise(function(resolve, reject){
|
8511
|
+
var promise, prop;
|
8512
|
+
|
8513
|
+
if (remaining === 0) {
|
8514
|
+
resolve({});
|
8515
|
+
return;
|
8252
8516
|
}
|
8253
|
-
}
|
8254
8517
|
|
8255
|
-
|
8256
|
-
|
8518
|
+
var resolver = function(prop) {
|
8519
|
+
return function(value) {
|
8520
|
+
resolveAll(prop, value);
|
8521
|
+
};
|
8522
|
+
};
|
8257
8523
|
|
8524
|
+
var resolveAll = function(prop, value) {
|
8525
|
+
results[prop] = value;
|
8526
|
+
if (--remaining === 0) {
|
8527
|
+
resolve(results);
|
8528
|
+
}
|
8529
|
+
};
|
8530
|
+
|
8531
|
+
|
8532
|
+
for (var i = 0, l = keys.length; i < l; i ++) {
|
8533
|
+
prop = keys[i];
|
8534
|
+
promise = object[prop];
|
8535
|
+
|
8536
|
+
if (promise && isFunction(promise.then)) {
|
8537
|
+
promise.then(resolver(prop), reject, "RSVP: RSVP#hash");
|
8538
|
+
} else {
|
8539
|
+
resolveAll(prop, promise);
|
8540
|
+
}
|
8541
|
+
}
|
8542
|
+
});
|
8543
|
+
}
|
8258
8544
|
|
8259
8545
|
__exports__.hash = hash;
|
8260
8546
|
});
|
8547
|
+
define("rsvp/instrument",
|
8548
|
+
["./config","./utils","exports"],
|
8549
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
8550
|
+
"use strict";
|
8551
|
+
var config = __dependency1__.config;
|
8552
|
+
var now = __dependency2__.now;
|
8553
|
+
|
8554
|
+
function instrument(eventName, promise, child) {
|
8555
|
+
// instrumentation should not disrupt normal usage.
|
8556
|
+
try {
|
8557
|
+
config.trigger(eventName, {
|
8558
|
+
guid: promise._guidKey + promise._id,
|
8559
|
+
eventName: eventName,
|
8560
|
+
detail: promise._detail,
|
8561
|
+
childGuid: child && promise._guidKey + child._id,
|
8562
|
+
label: promise._label,
|
8563
|
+
timeStamp: now()
|
8564
|
+
});
|
8565
|
+
} catch(error) {
|
8566
|
+
setTimeout(function(){
|
8567
|
+
throw error;
|
8568
|
+
}, 0);
|
8569
|
+
}
|
8570
|
+
}
|
8571
|
+
|
8572
|
+
__exports__.instrument = instrument;
|
8573
|
+
});
|
8261
8574
|
define("rsvp/node",
|
8262
|
-
["
|
8575
|
+
["./promise","./all","exports"],
|
8263
8576
|
function(__dependency1__, __dependency2__, __exports__) {
|
8264
8577
|
"use strict";
|
8265
8578
|
var Promise = __dependency1__.Promise;
|
8266
8579
|
var all = __dependency2__.all;
|
8267
8580
|
|
8581
|
+
var slice = Array.prototype.slice;
|
8582
|
+
|
8268
8583
|
function makeNodeCallbackFor(resolve, reject) {
|
8269
8584
|
return function (error, value) {
|
8270
8585
|
if (error) {
|
8271
8586
|
reject(error);
|
8272
8587
|
} else if (arguments.length > 2) {
|
8273
|
-
resolve(
|
8588
|
+
resolve(slice.call(arguments, 1));
|
8274
8589
|
} else {
|
8275
8590
|
resolve(value);
|
8276
8591
|
}
|
8277
8592
|
};
|
8278
8593
|
}
|
8279
8594
|
|
8280
|
-
|
8281
|
-
|
8282
|
-
|
8283
|
-
|
8595
|
+
/**
|
8596
|
+
`RSVP.denodeify` takes a "node-style" function and returns a function that
|
8597
|
+
will return an `RSVP.Promise`. You can use `denodeify` in Node.js or the
|
8598
|
+
browser when you'd prefer to use promises over using callbacks. For example,
|
8599
|
+
`denodeify` transforms the following:
|
8284
8600
|
|
8285
|
-
|
8286
|
-
|
8287
|
-
reject = nodeReject;
|
8288
|
-
});
|
8601
|
+
```javascript
|
8602
|
+
var fs = require('fs');
|
8289
8603
|
|
8290
|
-
|
8291
|
-
|
8604
|
+
fs.readFile('myfile.txt', function(err, data){
|
8605
|
+
if (err) return handleError(err);
|
8606
|
+
handleData(data);
|
8607
|
+
});
|
8608
|
+
```
|
8292
8609
|
|
8293
|
-
|
8294
|
-
|
8295
|
-
|
8296
|
-
|
8297
|
-
}
|
8298
|
-
});
|
8610
|
+
into:
|
8611
|
+
|
8612
|
+
```javascript
|
8613
|
+
var fs = require('fs');
|
8299
8614
|
|
8300
|
-
|
8615
|
+
var readFile = RSVP.denodeify(fs.readFile);
|
8616
|
+
|
8617
|
+
readFile('myfile.txt').then(handleData, handleError);
|
8618
|
+
```
|
8619
|
+
|
8620
|
+
Using `denodeify` makes it easier to compose asynchronous operations instead
|
8621
|
+
of using callbacks. For example, instead of:
|
8622
|
+
|
8623
|
+
```javascript
|
8624
|
+
var fs = require('fs');
|
8625
|
+
var log = require('some-async-logger');
|
8626
|
+
|
8627
|
+
fs.readFile('myfile.txt', function(err, data){
|
8628
|
+
if (err) return handleError(err);
|
8629
|
+
fs.writeFile('myfile2.txt', data, function(err){
|
8630
|
+
if (err) throw err;
|
8631
|
+
log('success', function(err) {
|
8632
|
+
if (err) throw err;
|
8633
|
+
});
|
8634
|
+
});
|
8635
|
+
});
|
8636
|
+
```
|
8637
|
+
|
8638
|
+
You can chain the operations together using `then` from the returned promise:
|
8639
|
+
|
8640
|
+
```javascript
|
8641
|
+
var fs = require('fs');
|
8642
|
+
var denodeify = RSVP.denodeify;
|
8643
|
+
var readFile = denodeify(fs.readFile);
|
8644
|
+
var writeFile = denodeify(fs.writeFile);
|
8645
|
+
var log = denodeify(require('some-async-logger'));
|
8646
|
+
|
8647
|
+
readFile('myfile.txt').then(function(data){
|
8648
|
+
return writeFile('myfile2.txt', data);
|
8649
|
+
}).then(function(){
|
8650
|
+
return log('SUCCESS');
|
8651
|
+
}).then(function(){
|
8652
|
+
// success handler
|
8653
|
+
}, function(reason){
|
8654
|
+
// rejection handler
|
8655
|
+
});
|
8656
|
+
```
|
8657
|
+
|
8658
|
+
@method denodeify
|
8659
|
+
@for RSVP
|
8660
|
+
@param {Function} nodeFunc a "node-style" function that takes a callback as
|
8661
|
+
its last argument. The callback expects an error to be passed as its first
|
8662
|
+
argument (if an error occurred, otherwise null), and the value from the
|
8663
|
+
operation as its second argument ("function(err, value){ }").
|
8664
|
+
@param {Any} binding optional argument for binding the "this" value when
|
8665
|
+
calling the `nodeFunc` function.
|
8666
|
+
@return {Function} a function that wraps `nodeFunc` to return an
|
8667
|
+
`RSVP.Promise`
|
8668
|
+
*/
|
8669
|
+
function denodeify(nodeFunc, binding) {
|
8670
|
+
return function() {
|
8671
|
+
var nodeArgs = slice.call(arguments), resolve, reject;
|
8672
|
+
var thisArg = this || binding;
|
8673
|
+
|
8674
|
+
return new Promise(function(resolve, reject) {
|
8675
|
+
all(nodeArgs).then(function(nodeArgs) {
|
8676
|
+
try {
|
8677
|
+
nodeArgs.push(makeNodeCallbackFor(resolve, reject));
|
8678
|
+
nodeFunc.apply(thisArg, nodeArgs);
|
8679
|
+
} catch(e) {
|
8680
|
+
reject(e);
|
8681
|
+
}
|
8682
|
+
});
|
8683
|
+
});
|
8301
8684
|
};
|
8302
8685
|
}
|
8303
8686
|
|
8304
|
-
|
8305
8687
|
__exports__.denodeify = denodeify;
|
8306
8688
|
});
|
8307
8689
|
define("rsvp/promise",
|
8308
|
-
["
|
8309
|
-
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
|
8690
|
+
["./config","./events","./cast","./instrument","./utils","exports"],
|
8691
|
+
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {
|
8310
8692
|
"use strict";
|
8311
8693
|
var config = __dependency1__.config;
|
8312
8694
|
var EventTarget = __dependency2__.EventTarget;
|
8313
8695
|
var cast = __dependency3__.cast;
|
8696
|
+
var instrument = __dependency4__.instrument;
|
8697
|
+
var objectOrFunction = __dependency5__.objectOrFunction;
|
8698
|
+
var isFunction = __dependency5__.isFunction;
|
8699
|
+
var now = __dependency5__.now;
|
8314
8700
|
|
8315
|
-
|
8316
|
-
|
8317
|
-
}
|
8318
|
-
|
8319
|
-
function isFunction(x){
|
8320
|
-
return typeof x === "function";
|
8321
|
-
}
|
8701
|
+
var guidKey = 'rsvp_' + now() + '-';
|
8702
|
+
var counter = 0;
|
8322
8703
|
|
8323
|
-
function Promise(resolver) {
|
8324
|
-
|
8325
|
-
|
8704
|
+
function Promise(resolver, label) {
|
8705
|
+
if (!isFunction(resolver)) {
|
8706
|
+
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
|
8707
|
+
}
|
8326
8708
|
|
8327
|
-
if (
|
8328
|
-
throw new TypeError('
|
8709
|
+
if (!(this instanceof Promise)) {
|
8710
|
+
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
|
8329
8711
|
}
|
8330
8712
|
|
8331
|
-
|
8332
|
-
|
8713
|
+
this._id = counter++;
|
8714
|
+
this._label = label;
|
8715
|
+
this._subscribers = [];
|
8716
|
+
|
8717
|
+
if (config.instrument) {
|
8718
|
+
instrument('created', this);
|
8333
8719
|
}
|
8334
8720
|
|
8335
|
-
|
8336
|
-
|
8337
|
-
|
8721
|
+
invokeResolver(resolver, this);
|
8722
|
+
}
|
8723
|
+
|
8724
|
+
function invokeResolver(resolver, promise) {
|
8725
|
+
function resolvePromise(value) {
|
8338
8726
|
resolve(promise, value);
|
8339
|
-
}
|
8727
|
+
}
|
8340
8728
|
|
8341
|
-
|
8342
|
-
|
8343
|
-
|
8344
|
-
reject(promise, value);
|
8345
|
-
};
|
8729
|
+
function rejectPromise(reason) {
|
8730
|
+
reject(promise, reason);
|
8731
|
+
}
|
8346
8732
|
|
8347
8733
|
try {
|
8348
8734
|
resolver(resolvePromise, rejectPromise);
|
@@ -8351,20 +8737,20 @@ define("rsvp/promise",
|
|
8351
8737
|
}
|
8352
8738
|
}
|
8353
8739
|
|
8354
|
-
|
8740
|
+
function invokeCallback(settled, promise, callback, detail) {
|
8355
8741
|
var hasCallback = isFunction(callback),
|
8356
8742
|
value, error, succeeded, failed;
|
8357
8743
|
|
8358
8744
|
if (hasCallback) {
|
8359
8745
|
try {
|
8360
|
-
value = callback(
|
8746
|
+
value = callback(detail);
|
8361
8747
|
succeeded = true;
|
8362
8748
|
} catch(e) {
|
8363
8749
|
failed = true;
|
8364
8750
|
error = e;
|
8365
8751
|
}
|
8366
8752
|
} else {
|
8367
|
-
value =
|
8753
|
+
value = detail;
|
8368
8754
|
succeeded = true;
|
8369
8755
|
}
|
8370
8756
|
|
@@ -8374,58 +8760,86 @@ define("rsvp/promise",
|
|
8374
8760
|
resolve(promise, value);
|
8375
8761
|
} else if (failed) {
|
8376
8762
|
reject(promise, error);
|
8377
|
-
} else if (
|
8763
|
+
} else if (settled === FULFILLED) {
|
8378
8764
|
resolve(promise, value);
|
8379
|
-
} else if (
|
8765
|
+
} else if (settled === REJECTED) {
|
8380
8766
|
reject(promise, value);
|
8381
8767
|
}
|
8382
|
-
}
|
8768
|
+
}
|
8769
|
+
|
8770
|
+
var PENDING = void 0;
|
8771
|
+
var SEALED = 0;
|
8772
|
+
var FULFILLED = 1;
|
8773
|
+
var REJECTED = 2;
|
8774
|
+
|
8775
|
+
function subscribe(parent, child, onFulfillment, onRejection) {
|
8776
|
+
var subscribers = parent._subscribers;
|
8777
|
+
var length = subscribers.length;
|
8778
|
+
|
8779
|
+
subscribers[length] = child;
|
8780
|
+
subscribers[length + FULFILLED] = onFulfillment;
|
8781
|
+
subscribers[length + REJECTED] = onRejection;
|
8782
|
+
}
|
8783
|
+
|
8784
|
+
function publish(promise, settled) {
|
8785
|
+
var child, callback, subscribers = promise._subscribers, detail = promise._detail;
|
8786
|
+
|
8787
|
+
if (config.instrument) {
|
8788
|
+
instrument(settled === FULFILLED ? 'fulfilled' : 'rejected', promise);
|
8789
|
+
}
|
8790
|
+
|
8791
|
+
for (var i = 0; i < subscribers.length; i += 3) {
|
8792
|
+
child = subscribers[i];
|
8793
|
+
callback = subscribers[i + settled];
|
8794
|
+
|
8795
|
+
invokeCallback(settled, child, callback, detail);
|
8796
|
+
}
|
8797
|
+
|
8798
|
+
promise._subscribers = null;
|
8799
|
+
}
|
8383
8800
|
|
8384
8801
|
Promise.prototype = {
|
8385
8802
|
constructor: Promise,
|
8386
|
-
|
8387
|
-
|
8388
|
-
|
8389
|
-
|
8803
|
+
|
8804
|
+
_id: undefined,
|
8805
|
+
_guidKey: guidKey,
|
8806
|
+
_label: undefined,
|
8807
|
+
|
8808
|
+
_state: undefined,
|
8809
|
+
_detail: undefined,
|
8810
|
+
_subscribers: undefined,
|
8390
8811
|
|
8391
8812
|
_onerror: function (reason) {
|
8392
|
-
config.trigger('error',
|
8393
|
-
detail: reason
|
8394
|
-
});
|
8813
|
+
config.trigger('error', reason);
|
8395
8814
|
},
|
8396
8815
|
|
8397
|
-
then: function(
|
8816
|
+
then: function(onFulfillment, onRejection, label) {
|
8817
|
+
var promise = this;
|
8398
8818
|
this._onerror = null;
|
8399
8819
|
|
8400
|
-
var thenPromise = new this.constructor(function() {});
|
8820
|
+
var thenPromise = new this.constructor(function() {}, label);
|
8401
8821
|
|
8402
|
-
if (this.
|
8403
|
-
|
8404
|
-
|
8405
|
-
|
8822
|
+
if (this._state) {
|
8823
|
+
var callbacks = arguments;
|
8824
|
+
config.async(function invokePromiseCallback() {
|
8825
|
+
invokeCallback(promise._state, thenPromise, callbacks[promise._state - 1], promise._detail);
|
8826
|
+
});
|
8827
|
+
} else {
|
8828
|
+
subscribe(this, thenPromise, onFulfillment, onRejection);
|
8406
8829
|
}
|
8407
8830
|
|
8408
|
-
if (
|
8409
|
-
|
8410
|
-
invokeCallback('reject', thenPromise, fail, { detail: promise.rejectedReason });
|
8411
|
-
}, this);
|
8831
|
+
if (config.instrument) {
|
8832
|
+
instrument('chained', promise, thenPromise);
|
8412
8833
|
}
|
8413
8834
|
|
8414
|
-
this.on('promise:resolved', function(event) {
|
8415
|
-
invokeCallback('resolve', thenPromise, done, event);
|
8416
|
-
});
|
8417
|
-
|
8418
|
-
this.on('promise:failed', function(event) {
|
8419
|
-
invokeCallback('reject', thenPromise, fail, event);
|
8420
|
-
});
|
8421
|
-
|
8422
8835
|
return thenPromise;
|
8423
8836
|
},
|
8424
8837
|
|
8425
|
-
|
8426
|
-
return this.then(null, onRejection);
|
8838
|
+
'catch': function(onRejection, label) {
|
8839
|
+
return this.then(null, onRejection, label);
|
8427
8840
|
},
|
8428
|
-
|
8841
|
+
|
8842
|
+
'finally': function(callback, label) {
|
8429
8843
|
var constructor = this.constructor;
|
8430
8844
|
|
8431
8845
|
return this.then(function(value) {
|
@@ -8436,23 +8850,12 @@ define("rsvp/promise",
|
|
8436
8850
|
return constructor.cast(callback()).then(function(){
|
8437
8851
|
throw reason;
|
8438
8852
|
});
|
8439
|
-
});
|
8853
|
+
}, label);
|
8440
8854
|
}
|
8441
8855
|
};
|
8442
8856
|
|
8443
|
-
Promise.prototype['catch'] = Promise.prototype.fail;
|
8444
8857
|
Promise.cast = cast;
|
8445
8858
|
|
8446
|
-
EventTarget.mixin(Promise.prototype);
|
8447
|
-
|
8448
|
-
function resolve(promise, value) {
|
8449
|
-
if (promise === value) {
|
8450
|
-
fulfill(promise, value);
|
8451
|
-
} else if (!handleThenable(promise, value)) {
|
8452
|
-
fulfill(promise, value);
|
8453
|
-
}
|
8454
|
-
}
|
8455
|
-
|
8456
8859
|
function handleThenable(promise, value) {
|
8457
8860
|
var then = null,
|
8458
8861
|
resolved;
|
@@ -8480,12 +8883,13 @@ define("rsvp/promise",
|
|
8480
8883
|
resolved = true;
|
8481
8884
|
|
8482
8885
|
reject(promise, val);
|
8483
|
-
});
|
8886
|
+
}, 'Locked onto ' + (promise._label || ' unknown promise'));
|
8484
8887
|
|
8485
8888
|
return true;
|
8486
8889
|
}
|
8487
8890
|
}
|
8488
8891
|
} catch (error) {
|
8892
|
+
if (resolved) { return true; }
|
8489
8893
|
reject(promise, error);
|
8490
8894
|
return true;
|
8491
8895
|
}
|
@@ -8493,53 +8897,229 @@ define("rsvp/promise",
|
|
8493
8897
|
return false;
|
8494
8898
|
}
|
8495
8899
|
|
8900
|
+
function resolve(promise, value) {
|
8901
|
+
if (promise === value) {
|
8902
|
+
fulfill(promise, value);
|
8903
|
+
} else if (!handleThenable(promise, value)) {
|
8904
|
+
fulfill(promise, value);
|
8905
|
+
}
|
8906
|
+
}
|
8907
|
+
|
8496
8908
|
function fulfill(promise, value) {
|
8497
|
-
|
8498
|
-
|
8499
|
-
|
8500
|
-
|
8501
|
-
|
8909
|
+
if (promise._state !== PENDING) { return; }
|
8910
|
+
promise._state = SEALED;
|
8911
|
+
promise._detail = value;
|
8912
|
+
|
8913
|
+
config.async(publishFulfillment, promise);
|
8502
8914
|
}
|
8503
8915
|
|
8504
|
-
function reject(promise,
|
8505
|
-
|
8506
|
-
|
8507
|
-
|
8508
|
-
|
8509
|
-
|
8510
|
-
});
|
8916
|
+
function reject(promise, reason) {
|
8917
|
+
if (promise._state !== PENDING) { return; }
|
8918
|
+
promise._state = SEALED;
|
8919
|
+
promise._detail = reason;
|
8920
|
+
|
8921
|
+
config.async(publishRejection, promise);
|
8511
8922
|
}
|
8512
8923
|
|
8924
|
+
function publishFulfillment(promise) {
|
8925
|
+
publish(promise, promise._state = FULFILLED);
|
8926
|
+
}
|
8927
|
+
|
8928
|
+
function publishRejection(promise) {
|
8929
|
+
if (promise._onerror) {
|
8930
|
+
promise._onerror(promise._detail);
|
8931
|
+
}
|
8932
|
+
|
8933
|
+
publish(promise, promise._state = REJECTED);
|
8934
|
+
}
|
8513
8935
|
|
8514
8936
|
__exports__.Promise = Promise;
|
8515
8937
|
});
|
8938
|
+
define("rsvp/race",
|
8939
|
+
["./promise","./utils","exports"],
|
8940
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
8941
|
+
"use strict";
|
8942
|
+
/* global toString */
|
8943
|
+
|
8944
|
+
var Promise = __dependency1__.Promise;
|
8945
|
+
var isArray = __dependency2__.isArray;
|
8946
|
+
|
8947
|
+
/**
|
8948
|
+
`RSVP.race` allows you to watch a series of promises and act as soon as the
|
8949
|
+
first promise given to the `promises` argument fulfills or rejects.
|
8950
|
+
|
8951
|
+
Example:
|
8952
|
+
|
8953
|
+
```javascript
|
8954
|
+
var promise1 = new RSVP.Promise(function(resolve, reject){
|
8955
|
+
setTimeout(function(){
|
8956
|
+
resolve("promise 1");
|
8957
|
+
}, 200);
|
8958
|
+
});
|
8959
|
+
|
8960
|
+
var promise2 = new RSVP.Promise(function(resolve, reject){
|
8961
|
+
setTimeout(function(){
|
8962
|
+
resolve("promise 2");
|
8963
|
+
}, 100);
|
8964
|
+
});
|
8965
|
+
|
8966
|
+
RSVP.race([promise1, promise2]).then(function(result){
|
8967
|
+
// result === "promise 2" because it was resolved before promise1
|
8968
|
+
// was resolved.
|
8969
|
+
});
|
8970
|
+
```
|
8971
|
+
|
8972
|
+
`RSVP.race` is deterministic in that only the state of the first completed
|
8973
|
+
promise matters. For example, even if other promises given to the `promises`
|
8974
|
+
array argument are resolved, but the first completed promise has become
|
8975
|
+
rejected before the other promises became fulfilled, the returned promise
|
8976
|
+
will become rejected:
|
8977
|
+
|
8978
|
+
```javascript
|
8979
|
+
var promise1 = new RSVP.Promise(function(resolve, reject){
|
8980
|
+
setTimeout(function(){
|
8981
|
+
resolve("promise 1");
|
8982
|
+
}, 200);
|
8983
|
+
});
|
8984
|
+
|
8985
|
+
var promise2 = new RSVP.Promise(function(resolve, reject){
|
8986
|
+
setTimeout(function(){
|
8987
|
+
reject(new Error("promise 2"));
|
8988
|
+
}, 100);
|
8989
|
+
});
|
8990
|
+
|
8991
|
+
RSVP.race([promise1, promise2]).then(function(result){
|
8992
|
+
// Code here never runs because there are rejected promises!
|
8993
|
+
}, function(reason){
|
8994
|
+
// reason.message === "promise2" because promise 2 became rejected before
|
8995
|
+
// promise 1 became fulfilled
|
8996
|
+
});
|
8997
|
+
```
|
8998
|
+
|
8999
|
+
@method race
|
9000
|
+
@for RSVP
|
9001
|
+
@param {Array} promises array of promises to observe
|
9002
|
+
@param {String} label optional string for describing the promise returned.
|
9003
|
+
Useful for tooling.
|
9004
|
+
@return {Promise} a promise that becomes fulfilled with the value the first
|
9005
|
+
completed promises is resolved with if the first completed promise was
|
9006
|
+
fulfilled, or rejected with the reason that the first completed promise
|
9007
|
+
was rejected with.
|
9008
|
+
*/
|
9009
|
+
function race(promises, label) {
|
9010
|
+
if (!isArray(promises)) {
|
9011
|
+
throw new TypeError('You must pass an array to race.');
|
9012
|
+
}
|
9013
|
+
return new Promise(function(resolve, reject) {
|
9014
|
+
var results = [], promise;
|
9015
|
+
|
9016
|
+
for (var i = 0; i < promises.length; i++) {
|
9017
|
+
promise = promises[i];
|
9018
|
+
|
9019
|
+
if (promise && typeof promise.then === 'function') {
|
9020
|
+
promise.then(resolve, reject, "RSVP: RSVP#race");
|
9021
|
+
} else {
|
9022
|
+
resolve(promise);
|
9023
|
+
}
|
9024
|
+
}
|
9025
|
+
}, label);
|
9026
|
+
}
|
9027
|
+
|
9028
|
+
__exports__.race = race;
|
9029
|
+
});
|
8516
9030
|
define("rsvp/reject",
|
8517
|
-
["
|
9031
|
+
["./promise","exports"],
|
8518
9032
|
function(__dependency1__, __exports__) {
|
8519
9033
|
"use strict";
|
8520
9034
|
var Promise = __dependency1__.Promise;
|
8521
9035
|
|
8522
|
-
|
9036
|
+
/**
|
9037
|
+
`RSVP.reject` returns a promise that will become rejected with the passed
|
9038
|
+
`reason`. `RSVP.reject` is essentially shorthand for the following:
|
9039
|
+
|
9040
|
+
```javascript
|
9041
|
+
var promise = new RSVP.Promise(function(resolve, reject){
|
9042
|
+
reject(new Error('WHOOPS'));
|
9043
|
+
});
|
9044
|
+
|
9045
|
+
promise.then(function(value){
|
9046
|
+
// Code here doesn't run because the promise is rejected!
|
9047
|
+
}, function(reason){
|
9048
|
+
// reason.message === 'WHOOPS'
|
9049
|
+
});
|
9050
|
+
```
|
9051
|
+
|
9052
|
+
Instead of writing the above, your code now simply becomes the following:
|
9053
|
+
|
9054
|
+
```javascript
|
9055
|
+
var promise = RSVP.reject(new Error('WHOOPS'));
|
9056
|
+
|
9057
|
+
promise.then(function(value){
|
9058
|
+
// Code here doesn't run because the promise is rejected!
|
9059
|
+
}, function(reason){
|
9060
|
+
// reason.message === 'WHOOPS'
|
9061
|
+
});
|
9062
|
+
```
|
9063
|
+
|
9064
|
+
@method reject
|
9065
|
+
@for RSVP
|
9066
|
+
@param {Any} reason value that the returned promise will be rejected with.
|
9067
|
+
@param {String} label optional string for identifying the returned promise.
|
9068
|
+
Useful for tooling.
|
9069
|
+
@return {Promise} a promise that will become rejected with the given
|
9070
|
+
`reason`.
|
9071
|
+
*/
|
9072
|
+
function reject(reason, label) {
|
8523
9073
|
return new Promise(function (resolve, reject) {
|
8524
9074
|
reject(reason);
|
8525
|
-
});
|
9075
|
+
}, label);
|
8526
9076
|
}
|
8527
9077
|
|
8528
|
-
|
8529
9078
|
__exports__.reject = reject;
|
8530
9079
|
});
|
8531
9080
|
define("rsvp/resolve",
|
8532
|
-
["
|
9081
|
+
["./promise","exports"],
|
8533
9082
|
function(__dependency1__, __exports__) {
|
8534
9083
|
"use strict";
|
8535
9084
|
var Promise = __dependency1__.Promise;
|
8536
9085
|
|
8537
|
-
|
8538
|
-
|
8539
|
-
|
9086
|
+
/**
|
9087
|
+
`RSVP.resolve` returns a promise that will become fulfilled with the passed
|
9088
|
+
`value`. `RSVP.resolve` is essentially shorthand for the following:
|
9089
|
+
|
9090
|
+
```javascript
|
9091
|
+
var promise = new RSVP.Promise(function(resolve, reject){
|
9092
|
+
resolve(1);
|
8540
9093
|
});
|
8541
|
-
}
|
8542
9094
|
|
9095
|
+
promise.then(function(value){
|
9096
|
+
// value === 1
|
9097
|
+
});
|
9098
|
+
```
|
9099
|
+
|
9100
|
+
Instead of writing the above, your code now simply becomes the following:
|
9101
|
+
|
9102
|
+
```javascript
|
9103
|
+
var promise = RSVP.resolve(1);
|
9104
|
+
|
9105
|
+
promise.then(function(value){
|
9106
|
+
// value === 1
|
9107
|
+
});
|
9108
|
+
```
|
9109
|
+
|
9110
|
+
@method resolve
|
9111
|
+
@for RSVP
|
9112
|
+
@param {Any} value value that the returned promise will be resolved with
|
9113
|
+
@param {String} label optional string for identifying the returned promise.
|
9114
|
+
Useful for tooling.
|
9115
|
+
@return {Promise} a promise that will become fulfilled with the given
|
9116
|
+
`value`
|
9117
|
+
*/
|
9118
|
+
function resolve(value, label) {
|
9119
|
+
return new Promise(function(resolve, reject) {
|
9120
|
+
resolve(value);
|
9121
|
+
}, label);
|
9122
|
+
}
|
8543
9123
|
|
8544
9124
|
__exports__.resolve = resolve;
|
8545
9125
|
});
|
@@ -8549,6 +9129,44 @@ define("rsvp/rethrow",
|
|
8549
9129
|
"use strict";
|
8550
9130
|
var local = (typeof global === "undefined") ? this : global;
|
8551
9131
|
|
9132
|
+
/**
|
9133
|
+
`RSVP.rethrow` will rethrow an error on the next turn of the JavaScript event
|
9134
|
+
loop in order to aid debugging.
|
9135
|
+
|
9136
|
+
Promises A+ specifies that any exceptions that occur with a promise must be
|
9137
|
+
caught by the promises implementation and bubbled to the last handler. For
|
9138
|
+
this reason, it is recommended that you always specify a second rejection
|
9139
|
+
handler function to `then`. However, `RSVP.rethrow` will throw the exception
|
9140
|
+
outside of the promise, so it bubbles up to your console if in the browser,
|
9141
|
+
or domain/cause uncaught exception in Node. `rethrow` will throw the error
|
9142
|
+
again so the error can be handled by the promise.
|
9143
|
+
|
9144
|
+
```javascript
|
9145
|
+
function throws(){
|
9146
|
+
throw new Error('Whoops!');
|
9147
|
+
}
|
9148
|
+
|
9149
|
+
var promise = new RSVP.Promise(function(resolve, reject){
|
9150
|
+
throws();
|
9151
|
+
});
|
9152
|
+
|
9153
|
+
promise.fail(RSVP.rethrow).then(function(){
|
9154
|
+
// Code here doesn't run because the promise became rejected due to an
|
9155
|
+
// error!
|
9156
|
+
}, function (err){
|
9157
|
+
// handle the error here
|
9158
|
+
});
|
9159
|
+
```
|
9160
|
+
|
9161
|
+
The 'Whoops' error will be thrown on the next turn of the event loop
|
9162
|
+
and you can watch for it in your console. You can also handle it using a
|
9163
|
+
rejection handler given to `.then` or `.fail` on the returned promise.
|
9164
|
+
|
9165
|
+
@method rethrow
|
9166
|
+
@for RSVP
|
9167
|
+
@param {Error} reason reason the promise became rejected.
|
9168
|
+
@throws Error
|
9169
|
+
*/
|
8552
9170
|
function rethrow(reason) {
|
8553
9171
|
local.setTimeout(function() {
|
8554
9172
|
throw reason;
|
@@ -8556,48 +9174,78 @@ define("rsvp/rethrow",
|
|
8556
9174
|
throw reason;
|
8557
9175
|
}
|
8558
9176
|
|
8559
|
-
|
8560
9177
|
__exports__.rethrow = rethrow;
|
8561
9178
|
});
|
9179
|
+
define("rsvp/utils",
|
9180
|
+
["exports"],
|
9181
|
+
function(__exports__) {
|
9182
|
+
"use strict";
|
9183
|
+
function objectOrFunction(x) {
|
9184
|
+
return isFunction(x) || (typeof x === "object" && x !== null);
|
9185
|
+
}
|
9186
|
+
|
9187
|
+
function isFunction(x) {
|
9188
|
+
return typeof x === "function";
|
9189
|
+
}
|
9190
|
+
|
9191
|
+
function isArray(x) {
|
9192
|
+
return Object.prototype.toString.call(x) === "[object Array]";
|
9193
|
+
}
|
9194
|
+
|
9195
|
+
// Date.now is not available in browsers < IE9
|
9196
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
|
9197
|
+
var now = Date.now || function() { return new Date().getTime(); };
|
9198
|
+
|
9199
|
+
|
9200
|
+
__exports__.objectOrFunction = objectOrFunction;
|
9201
|
+
__exports__.isFunction = isFunction;
|
9202
|
+
__exports__.isArray = isArray;
|
9203
|
+
__exports__.now = now;
|
9204
|
+
});
|
8562
9205
|
define("rsvp",
|
8563
|
-
["rsvp/events","rsvp/promise","rsvp/node","rsvp/all","rsvp/hash","rsvp/rethrow","rsvp/defer","rsvp/config","rsvp/resolve","rsvp/reject","
|
9206
|
+
["./rsvp/events","./rsvp/promise","./rsvp/node","./rsvp/all","./rsvp/race","./rsvp/hash","./rsvp/rethrow","./rsvp/defer","./rsvp/config","./rsvp/resolve","./rsvp/reject", "exports"],
|
8564
9207
|
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __exports__) {
|
8565
9208
|
"use strict";
|
8566
9209
|
var EventTarget = __dependency1__.EventTarget;
|
8567
9210
|
var Promise = __dependency2__.Promise;
|
8568
9211
|
var denodeify = __dependency3__.denodeify;
|
8569
9212
|
var all = __dependency4__.all;
|
8570
|
-
var
|
8571
|
-
var
|
8572
|
-
var
|
8573
|
-
var
|
8574
|
-
var
|
8575
|
-
var
|
8576
|
-
var
|
8577
|
-
var
|
8578
|
-
|
8579
|
-
|
8580
|
-
|
8581
|
-
|
9213
|
+
var race = __dependency5__.race;
|
9214
|
+
var hash = __dependency6__.hash;
|
9215
|
+
var rethrow = __dependency7__.rethrow;
|
9216
|
+
var defer = __dependency8__.defer;
|
9217
|
+
var config = __dependency9__.config;
|
9218
|
+
var configure = __dependency9__.configure;
|
9219
|
+
var resolve = __dependency10__.resolve;
|
9220
|
+
var reject = __dependency11__.reject;
|
9221
|
+
|
9222
|
+
function async(callback, arg) {
|
9223
|
+
config.async(callback, arg);
|
9224
|
+
}
|
9225
|
+
|
9226
|
+
function on() {
|
9227
|
+
config.on.apply(config, arguments);
|
9228
|
+
}
|
8582
9229
|
|
9230
|
+
function off() {
|
9231
|
+
config.off.apply(config, arguments);
|
9232
|
+
}
|
8583
9233
|
|
8584
9234
|
__exports__.Promise = Promise;
|
8585
9235
|
__exports__.EventTarget = EventTarget;
|
8586
9236
|
__exports__.all = all;
|
9237
|
+
__exports__.race = race;
|
8587
9238
|
__exports__.hash = hash;
|
8588
9239
|
__exports__.rethrow = rethrow;
|
8589
9240
|
__exports__.defer = defer;
|
8590
9241
|
__exports__.denodeify = denodeify;
|
8591
9242
|
__exports__.configure = configure;
|
8592
|
-
__exports__.trigger = trigger;
|
8593
9243
|
__exports__.on = on;
|
8594
9244
|
__exports__.off = off;
|
8595
9245
|
__exports__.resolve = resolve;
|
8596
9246
|
__exports__.reject = reject;
|
8597
9247
|
__exports__.async = async;
|
8598
|
-
__exports__.asyncDefault = asyncDefault;
|
8599
9248
|
});
|
8600
|
-
|
8601
9249
|
})();
|
8602
9250
|
|
8603
9251
|
(function() {
|
@@ -8650,6 +9298,7 @@ define("container",
|
|
8650
9298
|
no matching key is found, return undefined.
|
8651
9299
|
|
8652
9300
|
@method get
|
9301
|
+
@param {String} key
|
8653
9302
|
@return {any}
|
8654
9303
|
*/
|
8655
9304
|
get: function(key) {
|
@@ -8947,6 +9596,8 @@ define("container",
|
|
8947
9596
|
to find the `fullName`.
|
8948
9597
|
|
8949
9598
|
@method describe
|
9599
|
+
@param {String} fullName
|
9600
|
+
@return {string} described fullName
|
8950
9601
|
*/
|
8951
9602
|
describe: function(fullName) {
|
8952
9603
|
return fullName;
|
@@ -8990,7 +9641,7 @@ define("container",
|
|
8990
9641
|
twitter instanceof Twitter; // => true
|
8991
9642
|
|
8992
9643
|
// by default the container will return singletons
|
8993
|
-
twitter2 = container.lookup('api:twitter');
|
9644
|
+
var twitter2 = container.lookup('api:twitter');
|
8994
9645
|
twitter instanceof Twitter; // => true
|
8995
9646
|
|
8996
9647
|
twitter === twitter2; //=> true
|
@@ -9152,8 +9803,8 @@ define("container",
|
|
9152
9803
|
|
9153
9804
|
Two forms of injections are possible:
|
9154
9805
|
|
9155
|
-
|
9156
|
-
|
9806
|
+
* Injecting one fullName on another fullName
|
9807
|
+
* Injecting one fullName on a type
|
9157
9808
|
|
9158
9809
|
Example:
|
9159
9810
|
|
@@ -10373,9 +11024,11 @@ Ember.Observable = Ember.Mixin.create({
|
|
10373
11024
|
return this;
|
10374
11025
|
},
|
10375
11026
|
|
11027
|
+
|
10376
11028
|
/**
|
10377
|
-
|
10378
|
-
|
11029
|
+
Sets a list of properties at once. These properties are set inside
|
11030
|
+
a single `beginPropertyChanges` and `endPropertyChanges` batch, so
|
11031
|
+
observers will be buffered.
|
10379
11032
|
|
10380
11033
|
```javascript
|
10381
11034
|
record.setProperties({ firstName: 'Charles', lastName: 'Jolley' });
|
@@ -10671,8 +11324,8 @@ Ember.Observable = Ember.Mixin.create({
|
|
10671
11324
|
|
10672
11325
|
(function() {
|
10673
11326
|
/**
|
10674
|
-
@module ember
|
10675
|
-
@submodule ember-runtime
|
11327
|
+
@module ember
|
11328
|
+
@submodule ember-runtime
|
10676
11329
|
*/
|
10677
11330
|
|
10678
11331
|
|
@@ -11021,27 +11674,33 @@ CoreObject.PrototypeMixin = Mixin.create({
|
|
11021
11674
|
than Javascript's `toString` typically does, in a generic way for all Ember
|
11022
11675
|
objects.
|
11023
11676
|
|
11024
|
-
|
11025
|
-
|
11026
|
-
|
11677
|
+
```javascript
|
11678
|
+
App.Person = Em.Object.extend()
|
11679
|
+
person = App.Person.create()
|
11680
|
+
person.toString() //=> "<App.Person:ember1024>"
|
11681
|
+
```
|
11027
11682
|
|
11028
11683
|
If the object's class is not defined on an Ember namespace, it will
|
11029
11684
|
indicate it is a subclass of the registered superclass:
|
11030
11685
|
|
11031
|
-
|
11032
|
-
|
11033
|
-
|
11686
|
+
```javascript
|
11687
|
+
Student = App.Person.extend()
|
11688
|
+
student = Student.create()
|
11689
|
+
student.toString() //=> "<(subclass of App.Person):ember1025>"
|
11690
|
+
```
|
11034
11691
|
|
11035
11692
|
If the method `toStringExtension` is defined, its return value will be
|
11036
11693
|
included in the output.
|
11037
11694
|
|
11038
|
-
|
11039
|
-
|
11040
|
-
|
11041
|
-
|
11042
|
-
|
11043
|
-
|
11044
|
-
|
11695
|
+
```javascript
|
11696
|
+
App.Teacher = App.Person.extend({
|
11697
|
+
toStringExtension: function() {
|
11698
|
+
return this.get('fullName');
|
11699
|
+
}
|
11700
|
+
});
|
11701
|
+
teacher = App.Teacher.create()
|
11702
|
+
teacher.toString(); //=> "<App.Teacher:ember1026:Tom Dale>"
|
11703
|
+
```
|
11045
11704
|
|
11046
11705
|
@method toString
|
11047
11706
|
@return {String} string representation
|
@@ -11237,7 +11896,6 @@ var ClassMixin = Mixin.create({
|
|
11237
11896
|
},
|
11238
11897
|
|
11239
11898
|
/**
|
11240
|
-
|
11241
11899
|
Augments a constructor's prototype with additional
|
11242
11900
|
properties and functions:
|
11243
11901
|
|
@@ -11280,7 +11938,6 @@ var ClassMixin = Mixin.create({
|
|
11280
11938
|
name: 'an object'
|
11281
11939
|
});
|
11282
11940
|
|
11283
|
-
|
11284
11941
|
MyObject.reopenClass({
|
11285
11942
|
canBuild: false
|
11286
11943
|
});
|
@@ -12163,7 +12820,9 @@ Ember.Enumerable = Ember.Mixin.create({
|
|
12163
12820
|
The callback method you provide should have the following signature (all
|
12164
12821
|
parameters are optional):
|
12165
12822
|
|
12166
|
-
|
12823
|
+
```javascript
|
12824
|
+
function(item, index, enumerable);
|
12825
|
+
```
|
12167
12826
|
|
12168
12827
|
- *item* is the current item in the iteration.
|
12169
12828
|
- *index* is the current index in the iteration
|
@@ -12469,7 +13128,7 @@ Ember.Enumerable = Ember.Mixin.create({
|
|
12469
13128
|
Returns `true` if the passed property resolves to `true` for any item in
|
12470
13129
|
the enumerable. This method is often simpler/faster than using a callback.
|
12471
13130
|
|
12472
|
-
@method
|
13131
|
+
@method isAny
|
12473
13132
|
@param {String} key the property to test
|
12474
13133
|
@param {String} [value] optional value to test against.
|
12475
13134
|
@return {Boolean} `true` if the passed function returns `true` for any item
|
@@ -12479,7 +13138,7 @@ Ember.Enumerable = Ember.Mixin.create({
|
|
12479
13138
|
},
|
12480
13139
|
|
12481
13140
|
/**
|
12482
|
-
@method
|
13141
|
+
@method anyBy
|
12483
13142
|
@param {String} key the property to test
|
12484
13143
|
@param {String} [value] optional value to test against.
|
12485
13144
|
@return {Boolean} `true` if the passed function returns `true` for any item
|
@@ -14961,26 +15620,18 @@ Ember.computed.sort = function (itemsKey, sortDefinition) {
|
|
14961
15620
|
|
14962
15621
|
|
14963
15622
|
(function() {
|
14964
|
-
/**
|
14965
|
-
Expose RSVP implementation
|
14966
|
-
|
14967
|
-
Documentation can be found here: https://github.com/tildeio/rsvp.js/blob/master/README.md
|
14968
|
-
|
14969
|
-
@class RSVP
|
14970
|
-
@namespace Ember
|
14971
|
-
@constructor
|
14972
|
-
*/
|
14973
15623
|
Ember.RSVP = requireModule('rsvp');
|
14974
15624
|
|
14975
|
-
Ember.RSVP.onerrorDefault = function(
|
14976
|
-
var error = event.detail;
|
14977
|
-
|
15625
|
+
Ember.RSVP.onerrorDefault = function(error) {
|
14978
15626
|
if (error instanceof Error) {
|
14979
|
-
Ember.Logger.error(error.stack);
|
14980
|
-
|
14981
15627
|
if (Ember.testing) {
|
14982
|
-
|
15628
|
+
if (Ember.Test && Ember.Test.adapter) {
|
15629
|
+
Ember.Test.adapter.exception(error);
|
15630
|
+
} else {
|
15631
|
+
throw error;
|
15632
|
+
}
|
14983
15633
|
} else {
|
15634
|
+
Ember.Logger.error(error.stack);
|
14984
15635
|
Ember.assert(error, false);
|
14985
15636
|
}
|
14986
15637
|
}
|
@@ -15624,7 +16275,7 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,/**
|
|
15624
16275
|
method. You can pass either a single index, or a start and a length.
|
15625
16276
|
|
15626
16277
|
If you pass a start and length that is beyond the
|
15627
|
-
length this method will throw an `OUT_OF_RANGE_EXCEPTION
|
16278
|
+
length this method will throw an `OUT_OF_RANGE_EXCEPTION`.
|
15628
16279
|
|
15629
16280
|
```javascript
|
15630
16281
|
var colors = ["red", "green", "blue", "yellow", "orange"];
|
@@ -15658,18 +16309,18 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,/**
|
|
15658
16309
|
is KVO-compliant.
|
15659
16310
|
|
15660
16311
|
```javascript
|
15661
|
-
var colors = ["red", "green"
|
15662
|
-
colors.pushObject("black");
|
15663
|
-
colors.pushObject(["yellow"
|
16312
|
+
var colors = ["red", "green"];
|
16313
|
+
colors.pushObject("black"); // ["red", "green", "black"]
|
16314
|
+
colors.pushObject(["yellow"]); // ["red", "green", ["yellow"]]
|
15664
16315
|
```
|
15665
16316
|
|
15666
16317
|
@method pushObject
|
15667
16318
|
@param {*} obj object to push
|
15668
|
-
@return
|
16319
|
+
@return The same obj passed as param
|
15669
16320
|
*/
|
15670
16321
|
pushObject: function(obj) {
|
15671
16322
|
this.insertAt(get(this, 'length'), obj) ;
|
15672
|
-
return obj
|
16323
|
+
return obj;
|
15673
16324
|
},
|
15674
16325
|
|
15675
16326
|
/**
|
@@ -15677,9 +16328,8 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,/**
|
|
15677
16328
|
notifying observers of the change until all objects are added.
|
15678
16329
|
|
15679
16330
|
```javascript
|
15680
|
-
var colors = ["red"
|
15681
|
-
colors.pushObjects(["
|
15682
|
-
colors.pushObjects(["yellow", "orange"]); // ["red", "green", "blue", "black", "yellow", "orange"]
|
16331
|
+
var colors = ["red"];
|
16332
|
+
colors.pushObjects(["yellow", "orange"]); // ["red", "yellow", "orange"]
|
15683
16333
|
```
|
15684
16334
|
|
15685
16335
|
@method pushObjects
|
@@ -15741,14 +16391,14 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,/**
|
|
15741
16391
|
KVO-compliant.
|
15742
16392
|
|
15743
16393
|
```javascript
|
15744
|
-
var colors = ["red"
|
15745
|
-
colors.unshiftObject("yellow");
|
15746
|
-
colors.unshiftObject(["black"
|
16394
|
+
var colors = ["red"];
|
16395
|
+
colors.unshiftObject("yellow"); // ["yellow", "red"]
|
16396
|
+
colors.unshiftObject(["black"]); // [["black"], "yellow", "red"]
|
15747
16397
|
```
|
15748
16398
|
|
15749
16399
|
@method unshiftObject
|
15750
16400
|
@param {*} obj object to unshift
|
15751
|
-
@return
|
16401
|
+
@return The same obj passed as param
|
15752
16402
|
*/
|
15753
16403
|
unshiftObject: function(obj) {
|
15754
16404
|
this.insertAt(0, obj) ;
|
@@ -15760,9 +16410,9 @@ Ember.MutableArray = Ember.Mixin.create(Ember.Array, Ember.MutableEnumerable,/**
|
|
15760
16410
|
observers until all objects have been added.
|
15761
16411
|
|
15762
16412
|
```javascript
|
15763
|
-
var colors = ["red"
|
15764
|
-
colors.unshiftObjects(["black", "white"]); // ["black", "white", "red"
|
15765
|
-
colors.unshiftObjects("yellow");
|
16413
|
+
var colors = ["red"];
|
16414
|
+
colors.unshiftObjects(["black", "white"]); // ["black", "white", "red"]
|
16415
|
+
colors.unshiftObjects("yellow"); // Type Error: 'undefined' is not a function
|
15766
16416
|
```
|
15767
16417
|
|
15768
16418
|
@method unshiftObjects
|
@@ -18150,32 +18800,31 @@ Ember.Deferred = Deferred;
|
|
18150
18800
|
var forEach = Ember.ArrayPolyfills.forEach;
|
18151
18801
|
|
18152
18802
|
/**
|
18153
|
-
@module ember
|
18154
|
-
@submodule ember-runtime
|
18803
|
+
@module ember
|
18804
|
+
@submodule ember-runtime
|
18155
18805
|
*/
|
18156
18806
|
|
18157
18807
|
var loadHooks = Ember.ENV.EMBER_LOAD_HOOKS || {};
|
18158
18808
|
var loaded = {};
|
18159
18809
|
|
18160
18810
|
/**
|
18811
|
+
Detects when a specific package of Ember (e.g. 'Ember.Handlebars')
|
18812
|
+
has fully loaded and is available for extension.
|
18161
18813
|
|
18162
|
-
|
18163
|
-
|
18814
|
+
The provided `callback` will be called with the `name` passed
|
18815
|
+
resolved from a string into the object:
|
18164
18816
|
|
18165
|
-
The provided `callback` will be called with the `name` passed
|
18166
|
-
resolved from a string into the object:
|
18167
|
-
|
18168
|
-
```javascript
|
18169
|
-
Ember.onLoad('Ember.Handlebars' function(hbars){
|
18170
|
-
hbars.registerHelper(...);
|
18171
|
-
});
|
18172
|
-
```
|
18173
18817
|
|
18818
|
+
``` javascript
|
18819
|
+
Ember.onLoad('Ember.Handlebars' function(hbars){
|
18820
|
+
hbars.registerHelper(...);
|
18821
|
+
});
|
18822
|
+
```
|
18174
18823
|
|
18175
|
-
@method onLoad
|
18176
|
-
@for Ember
|
18177
|
-
@param name {String} name of hook
|
18178
|
-
@param callback {Function} callback to be called
|
18824
|
+
@method onLoad
|
18825
|
+
@for Ember
|
18826
|
+
@param name {String} name of hook
|
18827
|
+
@param callback {Function} callback to be called
|
18179
18828
|
*/
|
18180
18829
|
Ember.onLoad = function(name, callback) {
|
18181
18830
|
var object;
|
@@ -18189,14 +18838,13 @@ Ember.onLoad = function(name, callback) {
|
|
18189
18838
|
};
|
18190
18839
|
|
18191
18840
|
/**
|
18841
|
+
Called when an Ember.js package (e.g Ember.Handlebars) has finished
|
18842
|
+
loading. Triggers any callbacks registered for this event.
|
18192
18843
|
|
18193
|
-
|
18194
|
-
|
18195
|
-
|
18196
|
-
@
|
18197
|
-
@for Ember
|
18198
|
-
@param name {String} name of hook
|
18199
|
-
@param object {Object} object to pass to callbacks
|
18844
|
+
@method runLoadHooks
|
18845
|
+
@for Ember
|
18846
|
+
@param name {String} name of hook
|
18847
|
+
@param object {Object} object to pass to callbacks
|
18200
18848
|
*/
|
18201
18849
|
Ember.runLoadHooks = function(name, object) {
|
18202
18850
|
loaded[name] = object;
|