ember-source 1.0.0.rc3 → 1.0.0.rc3.1
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.
- data/dist/ember-data-deps.js +479 -133
- data/dist/ember-data-deps.min.js +5 -5
- data/dist/ember-data-deps.prod.js +473 -127
- data/dist/ember-debug.js +2 -2
- data/dist/ember-old-router.js +523 -140
- data/dist/ember-old-router.min.js +8 -8
- data/dist/ember-old-router.prod.js +517 -134
- data/dist/ember-runtime.js +479 -133
- data/dist/ember-runtime.min.js +5 -5
- data/dist/ember-runtime.prod.js +473 -127
- data/dist/ember-spade.js +1 -1
- data/dist/ember-template-compiler.js +18 -3
- data/dist/ember-template-compiler.min.js +3 -3
- data/dist/ember-template-compiler.prod.js +16 -1
- data/dist/ember-tests.js +1 -1
- data/dist/ember.js +638 -244
- data/dist/ember.min.js +9 -9
- data/dist/ember.prod.js +629 -235
- metadata +3 -5
data/dist/ember-runtime.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
// Version: v1.0.0-rc.
|
2
|
-
// Last commit:
|
1
|
+
// Version: v1.0.0-rc.1-536-gd47406c
|
2
|
+
// Last commit: d47406c (2013-04-25 17:21:02 -0700)
|
3
3
|
|
4
4
|
|
5
5
|
(function() {
|
@@ -151,8 +151,8 @@ Ember.deprecateFunc = function(message, func) {
|
|
151
151
|
|
152
152
|
})();
|
153
153
|
|
154
|
-
// Version: v1.0.0-rc.
|
155
|
-
// Last commit:
|
154
|
+
// Version: v1.0.0-rc.1-536-gd47406c
|
155
|
+
// Last commit: d47406c (2013-04-25 17:21:02 -0700)
|
156
156
|
|
157
157
|
|
158
158
|
(function() {
|
@@ -467,7 +467,7 @@ Ember.none = Ember.deprecateFunc("Ember.none is deprecated. Please use Ember.isN
|
|
467
467
|
@return {Boolean}
|
468
468
|
*/
|
469
469
|
Ember.isEmpty = function(obj) {
|
470
|
-
return obj
|
470
|
+
return Ember.isNone(obj) || (obj.length === 0 && typeof obj !== 'function') || (typeof obj === 'object' && Ember.get(obj, 'length') === 0);
|
471
471
|
};
|
472
472
|
Ember.empty = Ember.deprecateFunc("Ember.empty is deprecated. Please use Ember.isEmpty instead.", Ember.isEmpty) ;
|
473
473
|
|
@@ -500,6 +500,13 @@ var platform = Ember.platform = {};
|
|
500
500
|
*/
|
501
501
|
Ember.create = Object.create;
|
502
502
|
|
503
|
+
// IE8 has Object.create but it couldn't treat property descripters.
|
504
|
+
if (Ember.create) {
|
505
|
+
if (Ember.create({a: 1}, {a: {value: 2}}).a !== 2) {
|
506
|
+
Ember.create = null;
|
507
|
+
}
|
508
|
+
}
|
509
|
+
|
503
510
|
// STUB_OBJECT_CREATE allows us to override other libraries that stub
|
504
511
|
// Object.create different than we would prefer
|
505
512
|
if (!Ember.create || Ember.ENV.STUB_OBJECT_CREATE) {
|
@@ -1992,13 +1999,12 @@ get = function get(obj, keyName) {
|
|
1992
1999
|
obj = null;
|
1993
2000
|
}
|
1994
2001
|
|
1995
|
-
|
1996
|
-
|
2002
|
+
Ember.assert("Cannot call get with '"+ keyName +"' on an undefined object.", obj !== undefined);
|
2003
|
+
|
2004
|
+
if (obj === null || keyName.indexOf('.') !== -1) {
|
1997
2005
|
return getPath(obj, keyName);
|
1998
2006
|
}
|
1999
2007
|
|
2000
|
-
Ember.assert("You need to provide an object and key to `get`.", !!obj && keyName);
|
2001
|
-
|
2002
2008
|
var meta = obj[META_KEY], desc = meta && meta.descs[keyName], ret;
|
2003
2009
|
if (desc) {
|
2004
2010
|
return desc.get(obj, keyName);
|
@@ -2070,7 +2076,7 @@ var getPath = Ember._getPath = function(root, path) {
|
|
2070
2076
|
|
2071
2077
|
parts = path.split(".");
|
2072
2078
|
len = parts.length;
|
2073
|
-
for (idx=0; root && idx<len; idx++) {
|
2079
|
+
for (idx=0; root !== undefined && root !== null && idx<len; idx++) {
|
2074
2080
|
root = get(root, parts[idx], true);
|
2075
2081
|
if (root && root.isDestroyed) { return undefined; }
|
2076
2082
|
}
|
@@ -2116,7 +2122,9 @@ Ember.getPath = Ember.deprecateFunc('getPath is deprecated since get now support
|
|
2116
2122
|
|
2117
2123
|
var o_create = Ember.create,
|
2118
2124
|
metaFor = Ember.meta,
|
2119
|
-
META_KEY = Ember.META_KEY
|
2125
|
+
META_KEY = Ember.META_KEY,
|
2126
|
+
/* listener flags */
|
2127
|
+
ONCE = 1, SUSPENDED = 2, IMMEDIATE = 4;
|
2120
2128
|
|
2121
2129
|
/*
|
2122
2130
|
The event system uses a series of nested hashes to store listeners on an
|
@@ -2129,7 +2137,7 @@ var o_create = Ember.create,
|
|
2129
2137
|
{
|
2130
2138
|
listeners: { // variable name: `listenerSet`
|
2131
2139
|
"foo:changed": [ // variable name: `actions`
|
2132
|
-
[target, method,
|
2140
|
+
[target, method, flags]
|
2133
2141
|
]
|
2134
2142
|
}
|
2135
2143
|
}
|
@@ -2175,12 +2183,11 @@ function actionsUnion(obj, eventName, otherActions) {
|
|
2175
2183
|
for (var i = actions.length - 1; i >= 0; i--) {
|
2176
2184
|
var target = actions[i][0],
|
2177
2185
|
method = actions[i][1],
|
2178
|
-
|
2179
|
-
suspended = actions[i][3],
|
2186
|
+
flags = actions[i][2],
|
2180
2187
|
actionIndex = indexOf(otherActions, target, method);
|
2181
2188
|
|
2182
2189
|
if (actionIndex === -1) {
|
2183
|
-
otherActions.push([target, method,
|
2190
|
+
otherActions.push([target, method, flags]);
|
2184
2191
|
}
|
2185
2192
|
}
|
2186
2193
|
}
|
@@ -2194,14 +2201,13 @@ function actionsDiff(obj, eventName, otherActions) {
|
|
2194
2201
|
for (var i = actions.length - 1; i >= 0; i--) {
|
2195
2202
|
var target = actions[i][0],
|
2196
2203
|
method = actions[i][1],
|
2197
|
-
|
2198
|
-
suspended = actions[i][3],
|
2204
|
+
flags = actions[i][2],
|
2199
2205
|
actionIndex = indexOf(otherActions, target, method);
|
2200
2206
|
|
2201
2207
|
if (actionIndex !== -1) { continue; }
|
2202
2208
|
|
2203
|
-
otherActions.push([target, method,
|
2204
|
-
diffActions.push([target, method,
|
2209
|
+
otherActions.push([target, method, flags]);
|
2210
|
+
diffActions.push([target, method, flags]);
|
2205
2211
|
}
|
2206
2212
|
|
2207
2213
|
return diffActions;
|
@@ -2227,11 +2233,14 @@ function addListener(obj, eventName, target, method, once) {
|
|
2227
2233
|
}
|
2228
2234
|
|
2229
2235
|
var actions = actionsFor(obj, eventName),
|
2230
|
-
actionIndex = indexOf(actions, target, method)
|
2236
|
+
actionIndex = indexOf(actions, target, method),
|
2237
|
+
flags = 0;
|
2238
|
+
|
2239
|
+
if (once) flags |= ONCE;
|
2231
2240
|
|
2232
2241
|
if (actionIndex !== -1) { return; }
|
2233
2242
|
|
2234
|
-
actions.push([target, method,
|
2243
|
+
actions.push([target, method, flags]);
|
2235
2244
|
|
2236
2245
|
if ('function' === typeof obj.didAddListener) {
|
2237
2246
|
obj.didAddListener(eventName, target, method);
|
@@ -2258,7 +2267,7 @@ function removeListener(obj, eventName, target, method) {
|
|
2258
2267
|
target = null;
|
2259
2268
|
}
|
2260
2269
|
|
2261
|
-
function _removeListener(target, method
|
2270
|
+
function _removeListener(target, method) {
|
2262
2271
|
var actions = actionsFor(obj, eventName),
|
2263
2272
|
actionIndex = indexOf(actions, target, method);
|
2264
2273
|
|
@@ -2315,12 +2324,12 @@ function suspendListener(obj, eventName, target, method, callback) {
|
|
2315
2324
|
|
2316
2325
|
if (actionIndex !== -1) {
|
2317
2326
|
action = actions[actionIndex].slice(); // copy it, otherwise we're modifying a shared object
|
2318
|
-
action[
|
2327
|
+
action[2] |= SUSPENDED; // mark the action as suspended
|
2319
2328
|
actions[actionIndex] = action; // replace the shared object with our copy
|
2320
2329
|
}
|
2321
2330
|
|
2322
2331
|
function tryable() { return callback.call(target); }
|
2323
|
-
function finalizer() { if (action) { action[
|
2332
|
+
function finalizer() { if (action) { action[2] &= ~SUSPENDED; } }
|
2324
2333
|
|
2325
2334
|
return Ember.tryFinally(tryable, finalizer);
|
2326
2335
|
}
|
@@ -2359,7 +2368,7 @@ function suspendListeners(obj, eventNames, target, method, callback) {
|
|
2359
2368
|
|
2360
2369
|
if (actionIndex !== -1) {
|
2361
2370
|
action = actions[actionIndex].slice();
|
2362
|
-
action[
|
2371
|
+
action[2] |= SUSPENDED;
|
2363
2372
|
actions[actionIndex] = action;
|
2364
2373
|
suspendedActions.push(action);
|
2365
2374
|
}
|
@@ -2369,7 +2378,7 @@ function suspendListeners(obj, eventNames, target, method, callback) {
|
|
2369
2378
|
|
2370
2379
|
function finalizer() {
|
2371
2380
|
for (i = 0, l = suspendedActions.length; i < l; i++) {
|
2372
|
-
suspendedActions[i][
|
2381
|
+
suspendedActions[i][2] &= ~SUSPENDED;
|
2373
2382
|
}
|
2374
2383
|
}
|
2375
2384
|
|
@@ -2419,13 +2428,11 @@ function sendEvent(obj, eventName, params, actions) {
|
|
2419
2428
|
if (!actions) { return; }
|
2420
2429
|
|
2421
2430
|
for (var i = actions.length - 1; i >= 0; i--) { // looping in reverse for once listeners
|
2422
|
-
|
2423
|
-
|
2424
|
-
var target =
|
2425
|
-
|
2426
|
-
|
2427
|
-
|
2428
|
-
if (once) { removeListener(obj, eventName, target, method); }
|
2431
|
+
var action = actions[i];
|
2432
|
+
if (!action) { continue; }
|
2433
|
+
var target = action[0], method = action[1], flags = action[2];
|
2434
|
+
if (flags & SUSPENDED) { continue; }
|
2435
|
+
if (flags & ONCE) { removeListener(obj, eventName, target, method); }
|
2429
2436
|
if (!target) { target = obj; }
|
2430
2437
|
if ('string' === typeof method) { method = target[method]; }
|
2431
2438
|
if (params) {
|
@@ -2505,7 +2512,7 @@ var guidFor = Ember.guidFor,
|
|
2505
2512
|
keyName: keyName,
|
2506
2513
|
eventName: eventName,
|
2507
2514
|
listeners: [
|
2508
|
-
[target, method,
|
2515
|
+
[target, method, flags]
|
2509
2516
|
]
|
2510
2517
|
},
|
2511
2518
|
...
|
@@ -4864,27 +4871,44 @@ Ember.run.sync = function() {
|
|
4864
4871
|
|
4865
4872
|
var timers = {}; // active timers...
|
4866
4873
|
|
4874
|
+
function sortByExpires(timerA, timerB) {
|
4875
|
+
var a = timerA.expires,
|
4876
|
+
b = timerB.expires;
|
4877
|
+
|
4878
|
+
if (a > b) { return 1; }
|
4879
|
+
if (a < b) { return -1; }
|
4880
|
+
return 0;
|
4881
|
+
}
|
4882
|
+
|
4867
4883
|
var scheduledLater, scheduledLaterExpires;
|
4868
4884
|
function invokeLaterTimers() {
|
4869
4885
|
scheduledLater = null;
|
4870
4886
|
run(function() {
|
4871
4887
|
var now = (+ new Date()), earliest = -1;
|
4888
|
+
var timersToBeInvoked = [];
|
4872
4889
|
for (var key in timers) {
|
4873
4890
|
if (!timers.hasOwnProperty(key)) { continue; }
|
4874
4891
|
var timer = timers[key];
|
4875
4892
|
if (timer && timer.expires) {
|
4876
4893
|
if (now >= timer.expires) {
|
4877
4894
|
delete timers[key];
|
4878
|
-
|
4895
|
+
timersToBeInvoked.push(timer);
|
4879
4896
|
} else {
|
4880
4897
|
if (earliest < 0 || (timer.expires < earliest)) { earliest = timer.expires; }
|
4881
4898
|
}
|
4882
4899
|
}
|
4883
4900
|
}
|
4884
4901
|
|
4902
|
+
forEach.call(timersToBeInvoked.sort(sortByExpires), function(timer) {
|
4903
|
+
invoke(timer.target, timer.method, timer.args, 2);
|
4904
|
+
});
|
4905
|
+
|
4885
4906
|
// schedule next timeout to fire when the earliest timer expires
|
4886
4907
|
if (earliest > 0) {
|
4887
|
-
|
4908
|
+
// To allow overwrite `setTimeout` as stub from test code.
|
4909
|
+
// The assignment to `window.setTimeout` doesn't equal to `setTimeout` in older IE.
|
4910
|
+
// So `window` is required.
|
4911
|
+
scheduledLater = window.setTimeout(invokeLaterTimers, earliest - now);
|
4888
4912
|
scheduledLaterExpires = earliest;
|
4889
4913
|
}
|
4890
4914
|
});
|
@@ -6308,14 +6332,57 @@ Ember Metal
|
|
6308
6332
|
})();
|
6309
6333
|
|
6310
6334
|
(function() {
|
6311
|
-
define("rsvp",
|
6312
|
-
[],
|
6313
|
-
function() {
|
6335
|
+
define("rsvp/all",
|
6336
|
+
["rsvp/defer","exports"],
|
6337
|
+
function(__dependency1__, __exports__) {
|
6338
|
+
"use strict";
|
6339
|
+
var defer = __dependency1__.defer;
|
6340
|
+
|
6341
|
+
function all(promises) {
|
6342
|
+
var results = [], deferred = defer(), remaining = promises.length;
|
6343
|
+
|
6344
|
+
if (remaining === 0) {
|
6345
|
+
deferred.resolve([]);
|
6346
|
+
}
|
6347
|
+
|
6348
|
+
var resolver = function(index) {
|
6349
|
+
return function(value) {
|
6350
|
+
resolveAll(index, value);
|
6351
|
+
};
|
6352
|
+
};
|
6353
|
+
|
6354
|
+
var resolveAll = function(index, value) {
|
6355
|
+
results[index] = value;
|
6356
|
+
if (--remaining === 0) {
|
6357
|
+
deferred.resolve(results);
|
6358
|
+
}
|
6359
|
+
};
|
6360
|
+
|
6361
|
+
var rejectAll = function(error) {
|
6362
|
+
deferred.reject(error);
|
6363
|
+
};
|
6364
|
+
|
6365
|
+
for (var i = 0; i < promises.length; i++) {
|
6366
|
+
if (promises[i] && typeof promises[i].then === 'function') {
|
6367
|
+
promises[i].then(resolver(i), rejectAll);
|
6368
|
+
} else {
|
6369
|
+
resolveAll(i, promises[i]);
|
6370
|
+
}
|
6371
|
+
}
|
6372
|
+
return deferred.promise;
|
6373
|
+
}
|
6374
|
+
|
6375
|
+
__exports__.all = all;
|
6376
|
+
});
|
6377
|
+
|
6378
|
+
define("rsvp/async",
|
6379
|
+
["exports"],
|
6380
|
+
function(__exports__) {
|
6314
6381
|
"use strict";
|
6315
6382
|
var browserGlobal = (typeof window !== 'undefined') ? window : {};
|
6316
6383
|
|
6317
|
-
var
|
6318
|
-
var
|
6384
|
+
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
|
6385
|
+
var async;
|
6319
6386
|
|
6320
6387
|
if (typeof process !== 'undefined' &&
|
6321
6388
|
{}.toString.call(process) === '[object process]') {
|
@@ -6324,10 +6391,10 @@ define("rsvp",
|
|
6324
6391
|
callback.call(binding);
|
6325
6392
|
});
|
6326
6393
|
};
|
6327
|
-
} else if (
|
6394
|
+
} else if (BrowserMutationObserver) {
|
6328
6395
|
var queue = [];
|
6329
6396
|
|
6330
|
-
var observer = new
|
6397
|
+
var observer = new BrowserMutationObserver(function() {
|
6331
6398
|
var toProcess = queue.slice();
|
6332
6399
|
queue = [];
|
6333
6400
|
|
@@ -6358,6 +6425,47 @@ define("rsvp",
|
|
6358
6425
|
};
|
6359
6426
|
}
|
6360
6427
|
|
6428
|
+
|
6429
|
+
__exports__.async = async;
|
6430
|
+
});
|
6431
|
+
|
6432
|
+
define("rsvp/config",
|
6433
|
+
["rsvp/async","exports"],
|
6434
|
+
function(__dependency1__, __exports__) {
|
6435
|
+
"use strict";
|
6436
|
+
var async = __dependency1__.async;
|
6437
|
+
|
6438
|
+
var config = {};
|
6439
|
+
config.async = async;
|
6440
|
+
|
6441
|
+
__exports__.config = config;
|
6442
|
+
});
|
6443
|
+
|
6444
|
+
define("rsvp/defer",
|
6445
|
+
["rsvp/promise","exports"],
|
6446
|
+
function(__dependency1__, __exports__) {
|
6447
|
+
"use strict";
|
6448
|
+
var Promise = __dependency1__.Promise;
|
6449
|
+
|
6450
|
+
function defer() {
|
6451
|
+
var deferred = {};
|
6452
|
+
|
6453
|
+
var promise = new Promise(function(resolve, reject) {
|
6454
|
+
deferred.resolve = resolve;
|
6455
|
+
deferred.reject = reject;
|
6456
|
+
});
|
6457
|
+
|
6458
|
+
deferred.promise = promise;
|
6459
|
+
return deferred;
|
6460
|
+
}
|
6461
|
+
|
6462
|
+
__exports__.defer = defer;
|
6463
|
+
});
|
6464
|
+
|
6465
|
+
define("rsvp/events",
|
6466
|
+
["exports"],
|
6467
|
+
function(__exports__) {
|
6468
|
+
"use strict";
|
6361
6469
|
var Event = function(type, options) {
|
6362
6470
|
this.type = type;
|
6363
6471
|
|
@@ -6452,7 +6560,148 @@ define("rsvp",
|
|
6452
6560
|
}
|
6453
6561
|
};
|
6454
6562
|
|
6455
|
-
|
6563
|
+
|
6564
|
+
__exports__.EventTarget = EventTarget;
|
6565
|
+
});
|
6566
|
+
|
6567
|
+
define("rsvp/hash",
|
6568
|
+
["rsvp/defer","exports"],
|
6569
|
+
function(__dependency1__, __exports__) {
|
6570
|
+
"use strict";
|
6571
|
+
var defer = __dependency1__.defer;
|
6572
|
+
|
6573
|
+
function size(object) {
|
6574
|
+
var size = 0;
|
6575
|
+
|
6576
|
+
for (var prop in object) {
|
6577
|
+
size++;
|
6578
|
+
}
|
6579
|
+
|
6580
|
+
return size;
|
6581
|
+
}
|
6582
|
+
|
6583
|
+
function hash(promises) {
|
6584
|
+
var results = {}, deferred = defer(), remaining = size(promises);
|
6585
|
+
|
6586
|
+
if (remaining === 0) {
|
6587
|
+
deferred.resolve({});
|
6588
|
+
}
|
6589
|
+
|
6590
|
+
var resolver = function(prop) {
|
6591
|
+
return function(value) {
|
6592
|
+
resolveAll(prop, value);
|
6593
|
+
};
|
6594
|
+
};
|
6595
|
+
|
6596
|
+
var resolveAll = function(prop, value) {
|
6597
|
+
results[prop] = value;
|
6598
|
+
if (--remaining === 0) {
|
6599
|
+
deferred.resolve(results);
|
6600
|
+
}
|
6601
|
+
};
|
6602
|
+
|
6603
|
+
var rejectAll = function(error) {
|
6604
|
+
deferred.reject(error);
|
6605
|
+
};
|
6606
|
+
|
6607
|
+
for (var prop in promises) {
|
6608
|
+
if (promises[prop] && typeof promises[prop].then === 'function') {
|
6609
|
+
promises[prop].then(resolver(prop), rejectAll);
|
6610
|
+
} else {
|
6611
|
+
resolveAll(prop, promises[prop]);
|
6612
|
+
}
|
6613
|
+
}
|
6614
|
+
|
6615
|
+
return deferred.promise;
|
6616
|
+
}
|
6617
|
+
|
6618
|
+
__exports__.hash = hash;
|
6619
|
+
});
|
6620
|
+
|
6621
|
+
define("rsvp/node",
|
6622
|
+
["rsvp/promise","rsvp/all","exports"],
|
6623
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
6624
|
+
"use strict";
|
6625
|
+
var Promise = __dependency1__.Promise;
|
6626
|
+
var all = __dependency2__.all;
|
6627
|
+
|
6628
|
+
function makeNodeCallbackFor(resolve, reject) {
|
6629
|
+
return function (error, value) {
|
6630
|
+
if (error) {
|
6631
|
+
reject(error);
|
6632
|
+
} else if (arguments.length > 2) {
|
6633
|
+
resolve(Array.prototype.slice.call(arguments, 1));
|
6634
|
+
} else {
|
6635
|
+
resolve(value);
|
6636
|
+
}
|
6637
|
+
};
|
6638
|
+
}
|
6639
|
+
|
6640
|
+
function denodeify(nodeFunc) {
|
6641
|
+
return function() {
|
6642
|
+
var nodeArgs = Array.prototype.slice.call(arguments), resolve, reject;
|
6643
|
+
|
6644
|
+
var promise = new Promise(function(nodeResolve, nodeReject) {
|
6645
|
+
resolve = nodeResolve;
|
6646
|
+
reject = nodeReject;
|
6647
|
+
});
|
6648
|
+
|
6649
|
+
all(nodeArgs).then(function(nodeArgs) {
|
6650
|
+
nodeArgs.push(makeNodeCallbackFor(resolve, reject));
|
6651
|
+
|
6652
|
+
try {
|
6653
|
+
nodeFunc.apply(this, nodeArgs);
|
6654
|
+
} catch(e) {
|
6655
|
+
reject(e);
|
6656
|
+
}
|
6657
|
+
});
|
6658
|
+
|
6659
|
+
return promise;
|
6660
|
+
};
|
6661
|
+
}
|
6662
|
+
|
6663
|
+
__exports__.denodeify = denodeify;
|
6664
|
+
});
|
6665
|
+
|
6666
|
+
define("rsvp/promise",
|
6667
|
+
["rsvp/config","rsvp/events","exports"],
|
6668
|
+
function(__dependency1__, __dependency2__, __exports__) {
|
6669
|
+
"use strict";
|
6670
|
+
var config = __dependency1__.config;
|
6671
|
+
var EventTarget = __dependency2__.EventTarget;
|
6672
|
+
|
6673
|
+
function objectOrFunction(x) {
|
6674
|
+
return isFunction(x) || (typeof x === "object" && x !== null);
|
6675
|
+
}
|
6676
|
+
|
6677
|
+
function isFunction(x){
|
6678
|
+
return typeof x === "function";
|
6679
|
+
}
|
6680
|
+
|
6681
|
+
var Promise = function(resolver) {
|
6682
|
+
var promise = this,
|
6683
|
+
resolved = false;
|
6684
|
+
|
6685
|
+
if (typeof resolver !== 'function') {
|
6686
|
+
throw new TypeError('You must pass a resolver function as the sole argument to the promise constructor');
|
6687
|
+
}
|
6688
|
+
|
6689
|
+
if (!(promise instanceof Promise)) {
|
6690
|
+
return new Promise(resolver);
|
6691
|
+
}
|
6692
|
+
|
6693
|
+
var resolvePromise = function(value) {
|
6694
|
+
if (resolved) { return; }
|
6695
|
+
resolved = true;
|
6696
|
+
resolve(promise, value);
|
6697
|
+
};
|
6698
|
+
|
6699
|
+
var rejectPromise = function(value) {
|
6700
|
+
if (resolved) { return; }
|
6701
|
+
resolved = true;
|
6702
|
+
reject(promise, value);
|
6703
|
+
};
|
6704
|
+
|
6456
6705
|
this.on('promise:resolved', function(event) {
|
6457
6706
|
this.trigger('success', { detail: event.detail });
|
6458
6707
|
}, this);
|
@@ -6460,12 +6709,12 @@ define("rsvp",
|
|
6460
6709
|
this.on('promise:failed', function(event) {
|
6461
6710
|
this.trigger('error', { detail: event.detail });
|
6462
6711
|
}, this);
|
6463
|
-
};
|
6464
6712
|
|
6465
|
-
|
6713
|
+
resolver(resolvePromise, rejectPromise);
|
6714
|
+
};
|
6466
6715
|
|
6467
6716
|
var invokeCallback = function(type, promise, callback, event) {
|
6468
|
-
var hasCallback =
|
6717
|
+
var hasCallback = isFunction(callback),
|
6469
6718
|
value, error, succeeded, failed;
|
6470
6719
|
|
6471
6720
|
if (hasCallback) {
|
@@ -6481,34 +6730,34 @@ define("rsvp",
|
|
6481
6730
|
succeeded = true;
|
6482
6731
|
}
|
6483
6732
|
|
6484
|
-
if (
|
6485
|
-
|
6486
|
-
promise.resolve(value);
|
6487
|
-
}, function(error) {
|
6488
|
-
promise.reject(error);
|
6489
|
-
});
|
6733
|
+
if (handleThenable(promise, value)) {
|
6734
|
+
return;
|
6490
6735
|
} else if (hasCallback && succeeded) {
|
6491
|
-
|
6736
|
+
resolve(promise, value);
|
6492
6737
|
} else if (failed) {
|
6493
|
-
|
6494
|
-
} else {
|
6495
|
-
promise
|
6738
|
+
reject(promise, error);
|
6739
|
+
} else if (type === 'resolve') {
|
6740
|
+
resolve(promise, value);
|
6741
|
+
} else if (type === 'reject') {
|
6742
|
+
reject(promise, value);
|
6496
6743
|
}
|
6497
6744
|
};
|
6498
6745
|
|
6499
6746
|
Promise.prototype = {
|
6747
|
+
constructor: Promise,
|
6748
|
+
|
6500
6749
|
then: function(done, fail) {
|
6501
|
-
var thenPromise = new Promise();
|
6750
|
+
var thenPromise = new Promise(function() {});
|
6502
6751
|
|
6503
|
-
if (this.
|
6504
|
-
|
6505
|
-
invokeCallback('resolve', thenPromise, done, { detail: this.
|
6752
|
+
if (this.isFulfilled) {
|
6753
|
+
config.async(function() {
|
6754
|
+
invokeCallback('resolve', thenPromise, done, { detail: this.fulfillmentValue });
|
6506
6755
|
}, this);
|
6507
6756
|
}
|
6508
6757
|
|
6509
6758
|
if (this.isRejected) {
|
6510
|
-
|
6511
|
-
invokeCallback('reject', thenPromise, fail, { detail: this.
|
6759
|
+
config.async(function() {
|
6760
|
+
invokeCallback('reject', thenPromise, fail, { detail: this.rejectedReason });
|
6512
6761
|
}, this);
|
6513
6762
|
}
|
6514
6763
|
|
@@ -6521,75 +6770,138 @@ define("rsvp",
|
|
6521
6770
|
});
|
6522
6771
|
|
6523
6772
|
return thenPromise;
|
6524
|
-
}
|
6773
|
+
}
|
6774
|
+
};
|
6525
6775
|
|
6526
|
-
|
6527
|
-
resolve(this, value);
|
6776
|
+
EventTarget.mixin(Promise.prototype);
|
6528
6777
|
|
6529
|
-
|
6530
|
-
|
6531
|
-
|
6778
|
+
function resolve(promise, value) {
|
6779
|
+
if (promise === value) {
|
6780
|
+
fulfill(promise, value);
|
6781
|
+
} else if (!handleThenable(promise, value)) {
|
6782
|
+
fulfill(promise, value);
|
6783
|
+
}
|
6784
|
+
}
|
6532
6785
|
|
6533
|
-
|
6534
|
-
|
6786
|
+
function handleThenable(promise, value) {
|
6787
|
+
var then = null;
|
6788
|
+
|
6789
|
+
if (objectOrFunction(value)) {
|
6790
|
+
try {
|
6791
|
+
then = value.then;
|
6792
|
+
} catch(e) {
|
6793
|
+
reject(promise, e);
|
6794
|
+
return true;
|
6795
|
+
}
|
6535
6796
|
|
6536
|
-
|
6537
|
-
|
6797
|
+
if (isFunction(then)) {
|
6798
|
+
try {
|
6799
|
+
then.call(value, function(val) {
|
6800
|
+
if (value !== val) {
|
6801
|
+
resolve(promise, val);
|
6802
|
+
} else {
|
6803
|
+
fulfill(promise, val);
|
6804
|
+
}
|
6805
|
+
}, function(val) {
|
6806
|
+
reject(promise, val);
|
6807
|
+
});
|
6808
|
+
} catch (e) {
|
6809
|
+
reject(promise, e);
|
6810
|
+
}
|
6811
|
+
return true;
|
6812
|
+
}
|
6538
6813
|
}
|
6539
|
-
};
|
6540
6814
|
|
6541
|
-
|
6542
|
-
|
6815
|
+
return false;
|
6816
|
+
}
|
6817
|
+
|
6818
|
+
function fulfill(promise, value) {
|
6819
|
+
config.async(function() {
|
6543
6820
|
promise.trigger('promise:resolved', { detail: value });
|
6544
|
-
promise.
|
6545
|
-
promise.
|
6821
|
+
promise.isFulfilled = true;
|
6822
|
+
promise.fulfillmentValue = value;
|
6546
6823
|
});
|
6547
6824
|
}
|
6548
6825
|
|
6549
6826
|
function reject(promise, value) {
|
6550
|
-
|
6827
|
+
config.async(function() {
|
6551
6828
|
promise.trigger('promise:failed', { detail: value });
|
6552
6829
|
promise.isRejected = true;
|
6553
|
-
promise.
|
6830
|
+
promise.rejectedReason = value;
|
6554
6831
|
});
|
6555
6832
|
}
|
6556
6833
|
|
6557
|
-
function all(promises) {
|
6558
|
-
var i, results = [];
|
6559
|
-
var allPromise = new Promise();
|
6560
|
-
var remaining = promises.length;
|
6561
6834
|
|
6562
|
-
|
6563
|
-
|
6564
|
-
}
|
6835
|
+
__exports__.Promise = Promise;
|
6836
|
+
});
|
6565
6837
|
|
6566
|
-
|
6567
|
-
|
6568
|
-
|
6569
|
-
|
6570
|
-
|
6838
|
+
define("rsvp/resolve",
|
6839
|
+
["rsvp/promise","exports"],
|
6840
|
+
function(__dependency1__, __exports__) {
|
6841
|
+
"use strict";
|
6842
|
+
var Promise = __dependency1__.Promise;
|
6571
6843
|
|
6572
|
-
var resolve = function(index, value) {
|
6573
|
-
results[index] = value;
|
6574
|
-
if (--remaining === 0) {
|
6575
|
-
allPromise.resolve(results);
|
6576
|
-
}
|
6577
|
-
};
|
6578
6844
|
|
6579
|
-
|
6580
|
-
|
6581
|
-
|
6845
|
+
function objectOrFunction(x) {
|
6846
|
+
return typeof x === "function" || (typeof x === "object" && x !== null);
|
6847
|
+
}
|
6582
6848
|
|
6583
|
-
|
6584
|
-
|
6585
|
-
|
6586
|
-
|
6849
|
+
function resolve(thenable){
|
6850
|
+
var promise = new Promise(function(resolve, reject){
|
6851
|
+
var then;
|
6852
|
+
|
6853
|
+
try {
|
6854
|
+
if ( objectOrFunction(thenable) ) {
|
6855
|
+
then = thenable.then;
|
6856
|
+
|
6857
|
+
if (typeof then === "function") {
|
6858
|
+
then.call(thenable, resolve, reject);
|
6859
|
+
} else {
|
6860
|
+
resolve(thenable);
|
6861
|
+
}
|
6862
|
+
|
6863
|
+
} else {
|
6864
|
+
resolve(thenable);
|
6865
|
+
}
|
6866
|
+
|
6867
|
+
} catch(error) {
|
6868
|
+
reject(error);
|
6869
|
+
}
|
6870
|
+
});
|
6871
|
+
|
6872
|
+
return promise;
|
6587
6873
|
}
|
6588
6874
|
|
6589
|
-
EventTarget.mixin(Promise.prototype);
|
6590
6875
|
|
6591
|
-
|
6592
|
-
|
6876
|
+
__exports__.resolve = resolve;
|
6877
|
+
});
|
6878
|
+
|
6879
|
+
define("rsvp",
|
6880
|
+
["rsvp/events","rsvp/promise","rsvp/node","rsvp/all","rsvp/hash","rsvp/defer","rsvp/config","rsvp/resolve","exports"],
|
6881
|
+
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __exports__) {
|
6882
|
+
"use strict";
|
6883
|
+
var EventTarget = __dependency1__.EventTarget;
|
6884
|
+
var Promise = __dependency2__.Promise;
|
6885
|
+
var denodeify = __dependency3__.denodeify;
|
6886
|
+
var all = __dependency4__.all;
|
6887
|
+
var hash = __dependency5__.hash;
|
6888
|
+
var defer = __dependency6__.defer;
|
6889
|
+
var config = __dependency7__.config;
|
6890
|
+
var resolve = __dependency8__.resolve;
|
6891
|
+
|
6892
|
+
function configure(name, value) {
|
6893
|
+
config[name] = value;
|
6894
|
+
}
|
6895
|
+
|
6896
|
+
|
6897
|
+
__exports__.Promise = Promise;
|
6898
|
+
__exports__.EventTarget = EventTarget;
|
6899
|
+
__exports__.all = all;
|
6900
|
+
__exports__.hash = hash;
|
6901
|
+
__exports__.defer = defer;
|
6902
|
+
__exports__.denodeify = denodeify;
|
6903
|
+
__exports__.configure = configure;
|
6904
|
+
__exports__.resolve = resolve;
|
6593
6905
|
});
|
6594
6906
|
|
6595
6907
|
})();
|
@@ -8575,9 +8887,7 @@ Ember.Enumerable = Ember.Mixin.create({
|
|
8575
8887
|
// HELPERS
|
8576
8888
|
//
|
8577
8889
|
|
8578
|
-
var get = Ember.get, set = Ember.set, map = Ember.EnumerableUtils.map, cacheFor = Ember.cacheFor;
|
8579
|
-
|
8580
|
-
function none(obj) { return obj===null || obj===undefined; }
|
8890
|
+
var get = Ember.get, set = Ember.set, isNone = Ember.isNone, map = Ember.EnumerableUtils.map, cacheFor = Ember.cacheFor;
|
8581
8891
|
|
8582
8892
|
// ..........................................................
|
8583
8893
|
// ARRAY
|
@@ -8727,8 +9037,8 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
|
|
8727
9037
|
slice: function(beginIndex, endIndex) {
|
8728
9038
|
var ret = Ember.A([]);
|
8729
9039
|
var length = get(this, 'length') ;
|
8730
|
-
if (
|
8731
|
-
if (
|
9040
|
+
if (isNone(beginIndex)) beginIndex = 0 ;
|
9041
|
+
if (isNone(endIndex) || (endIndex > length)) endIndex = length ;
|
8732
9042
|
|
8733
9043
|
if (beginIndex < 0) beginIndex = length + beginIndex;
|
8734
9044
|
if (endIndex < 0) endIndex = length + endIndex;
|
@@ -8888,7 +9198,7 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
|
|
8888
9198
|
@param {Number} startIdx The starting index in the array that will change.
|
8889
9199
|
@param {Number} removeAmt The number of items that will be removed. If you
|
8890
9200
|
pass `null` assumes 0
|
8891
|
-
@param {Number} addAmt The number of items that will be added
|
9201
|
+
@param {Number} addAmt The number of items that will be added. If you
|
8892
9202
|
pass `null` assumes 0.
|
8893
9203
|
@return {Ember.Array} receiver
|
8894
9204
|
*/
|
@@ -8922,6 +9232,20 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
|
|
8922
9232
|
return this;
|
8923
9233
|
},
|
8924
9234
|
|
9235
|
+
/**
|
9236
|
+
If you are implementing an object that supports `Ember.Array`, call this
|
9237
|
+
method just after the array content changes to notify any observers and
|
9238
|
+
invalidate any related properties. Pass the starting index of the change
|
9239
|
+
as well as a delta of the amounts to change.
|
9240
|
+
|
9241
|
+
@method arrayContentDidChange
|
9242
|
+
@param {Number} startIdx The starting index in the array that did change.
|
9243
|
+
@param {Number} removeAmt The number of items that were removed. If you
|
9244
|
+
pass `null` assumes 0
|
9245
|
+
@param {Number} addAmt The number of items that were added. If you
|
9246
|
+
pass `null` assumes 0.
|
9247
|
+
@return {Ember.Array} receiver
|
9248
|
+
*/
|
8925
9249
|
arrayContentDidChange: function(startIdx, removeAmt, addAmt) {
|
8926
9250
|
|
8927
9251
|
// if no args are passed assume everything changes
|
@@ -10080,7 +10404,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
|
|
10080
10404
|
@return {Object} The new property value
|
10081
10405
|
*/
|
10082
10406
|
incrementProperty: function(keyName, increment) {
|
10083
|
-
if (
|
10407
|
+
if (Ember.isNone(increment)) { increment = 1; }
|
10084
10408
|
set(this, keyName, (get(this, keyName) || 0)+increment);
|
10085
10409
|
return get(this, keyName);
|
10086
10410
|
},
|
@@ -10099,7 +10423,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
|
|
10099
10423
|
@return {Object} The new property value
|
10100
10424
|
*/
|
10101
10425
|
decrementProperty: function(keyName, increment) {
|
10102
|
-
if (
|
10426
|
+
if (Ember.isNone(increment)) { increment = 1; }
|
10103
10427
|
set(this, keyName, (get(this, keyName) || 0)-increment);
|
10104
10428
|
return get(this, keyName);
|
10105
10429
|
},
|
@@ -10436,9 +10760,9 @@ Ember.Evented = Ember.Mixin.create({
|
|
10436
10760
|
(function() {
|
10437
10761
|
var RSVP = requireModule("rsvp");
|
10438
10762
|
|
10439
|
-
RSVP.async
|
10763
|
+
RSVP.configure('async', function(callback, binding) {
|
10440
10764
|
Ember.run.schedule('actions', binding, callback);
|
10441
|
-
};
|
10765
|
+
});
|
10442
10766
|
|
10443
10767
|
/**
|
10444
10768
|
@module ember
|
@@ -10460,9 +10784,22 @@ Ember.DeferredMixin = Ember.Mixin.create({
|
|
10460
10784
|
@param {Function} doneCallback a callback function to be called when done
|
10461
10785
|
@param {Function} failCallback a callback function to be called when failed
|
10462
10786
|
*/
|
10463
|
-
then: function(
|
10464
|
-
var promise
|
10465
|
-
|
10787
|
+
then: function(resolve, reject) {
|
10788
|
+
var deferred, promise, entity;
|
10789
|
+
|
10790
|
+
entity = this;
|
10791
|
+
deferred = get(this, '_deferred');
|
10792
|
+
promise = deferred.promise;
|
10793
|
+
|
10794
|
+
return promise.then(function(fulfillment) {
|
10795
|
+
if (fulfillment === promise) {
|
10796
|
+
return resolve(entity);
|
10797
|
+
} else {
|
10798
|
+
return resolve(fulfillment);
|
10799
|
+
}
|
10800
|
+
}, function(reason) {
|
10801
|
+
return reject(reason);
|
10802
|
+
});
|
10466
10803
|
},
|
10467
10804
|
|
10468
10805
|
/**
|
@@ -10471,7 +10808,16 @@ Ember.DeferredMixin = Ember.Mixin.create({
|
|
10471
10808
|
@method resolve
|
10472
10809
|
*/
|
10473
10810
|
resolve: function(value) {
|
10474
|
-
|
10811
|
+
var deferred, promise;
|
10812
|
+
|
10813
|
+
deferred = get(this, '_deferred');
|
10814
|
+
promise = deferred.promise;
|
10815
|
+
|
10816
|
+
if (value === this){
|
10817
|
+
deferred.resolve(promise);
|
10818
|
+
} else {
|
10819
|
+
deferred.resolve(value);
|
10820
|
+
}
|
10475
10821
|
},
|
10476
10822
|
|
10477
10823
|
/**
|
@@ -10480,11 +10826,11 @@ Ember.DeferredMixin = Ember.Mixin.create({
|
|
10480
10826
|
@method reject
|
10481
10827
|
*/
|
10482
10828
|
reject: function(value) {
|
10483
|
-
get(this, '
|
10829
|
+
get(this, '_deferred').reject(value);
|
10484
10830
|
},
|
10485
10831
|
|
10486
|
-
|
10487
|
-
return new RSVP.
|
10832
|
+
_deferred: Ember.computed(function() {
|
10833
|
+
return new RSVP.defer();
|
10488
10834
|
})
|
10489
10835
|
});
|
10490
10836
|
|
@@ -12133,7 +12479,7 @@ if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Array) {
|
|
12133
12479
|
@submodule ember-runtime
|
12134
12480
|
*/
|
12135
12481
|
|
12136
|
-
var get = Ember.get, set = Ember.set, guidFor = Ember.guidFor,
|
12482
|
+
var get = Ember.get, set = Ember.set, guidFor = Ember.guidFor, isNone = Ember.isNone, fmt = Ember.String.fmt;
|
12137
12483
|
|
12138
12484
|
/**
|
12139
12485
|
An unordered collection of objects.
|
@@ -12491,7 +12837,7 @@ Ember.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Emb
|
|
12491
12837
|
// implements Ember.MutableEnumerable
|
12492
12838
|
addObject: function(obj) {
|
12493
12839
|
if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);
|
12494
|
-
if (
|
12840
|
+
if (isNone(obj)) return this; // nothing to do
|
12495
12841
|
|
12496
12842
|
var guid = guidFor(obj),
|
12497
12843
|
idx = this[guid],
|
@@ -12519,7 +12865,7 @@ Ember.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Emb
|
|
12519
12865
|
// implements Ember.MutableEnumerable
|
12520
12866
|
removeObject: function(obj) {
|
12521
12867
|
if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);
|
12522
|
-
if (
|
12868
|
+
if (isNone(obj)) return this; // nothing to do
|
12523
12869
|
|
12524
12870
|
var guid = guidFor(obj),
|
12525
12871
|
idx = this[guid],
|
@@ -12594,7 +12940,7 @@ Deferred.reopenClass({
|
|
12594
12940
|
promise: function(callback, binding) {
|
12595
12941
|
var deferred = Deferred.create();
|
12596
12942
|
callback.call(binding, deferred);
|
12597
|
-
return
|
12943
|
+
return deferred;
|
12598
12944
|
}
|
12599
12945
|
});
|
12600
12946
|
|
@@ -12605,6 +12951,8 @@ Ember.Deferred = Deferred;
|
|
12605
12951
|
|
12606
12952
|
|
12607
12953
|
(function() {
|
12954
|
+
var forEach = Ember.ArrayPolyfills.forEach;
|
12955
|
+
|
12608
12956
|
/**
|
12609
12957
|
@module ember
|
12610
12958
|
@submodule ember-runtime
|
@@ -12637,12 +12985,10 @@ Ember.onLoad = function(name, callback) {
|
|
12637
12985
|
@param object {Object} object to pass to callbacks
|
12638
12986
|
*/
|
12639
12987
|
Ember.runLoadHooks = function(name, object) {
|
12640
|
-
var hooks;
|
12641
|
-
|
12642
12988
|
loaded[name] = object;
|
12643
12989
|
|
12644
|
-
if (
|
12645
|
-
loadHooks[name]
|
12990
|
+
if (loadHooks[name]) {
|
12991
|
+
forEach.call(loadHooks[name], function(callback) {
|
12646
12992
|
callback(object);
|
12647
12993
|
});
|
12648
12994
|
}
|