ember-source 0.0.5 → 0.0.6
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.
- data/dist/ember-data-deps.js +731 -273
- data/dist/ember-data-deps.min.js +5 -5
- data/dist/ember-data-deps.prod.js +725 -267
- data/dist/ember-debug.js +2 -2
- data/dist/ember-old-router.js +965 -389
- data/dist/ember-old-router.min.js +8 -8
- data/dist/ember-old-router.prod.js +958 -382
- data/dist/ember-runtime.js +707 -269
- data/dist/ember-runtime.min.js +5 -5
- data/dist/ember-runtime.prod.js +701 -263
- 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 +1494 -562
- data/dist/ember.min.js +9 -8
- data/dist/ember.prod.js +1459 -527
- metadata +2 -2
data/dist/ember-debug.js
CHANGED
data/dist/ember-old-router.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
// Version: v1.0.0-rc.1-
|
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.1-
|
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() {
|
@@ -212,7 +212,7 @@ var define, requireModule;
|
|
212
212
|
|
213
213
|
@class Ember
|
214
214
|
@static
|
215
|
-
@version 1.0.0-rc.
|
215
|
+
@version 1.0.0-rc.3
|
216
216
|
*/
|
217
217
|
|
218
218
|
if ('undefined' === typeof Ember) {
|
@@ -239,10 +239,10 @@ Ember.toString = function() { return "Ember"; };
|
|
239
239
|
/**
|
240
240
|
@property VERSION
|
241
241
|
@type String
|
242
|
-
@default '1.0.0-rc.
|
242
|
+
@default '1.0.0-rc.3'
|
243
243
|
@final
|
244
244
|
*/
|
245
|
-
Ember.VERSION = '1.0.0-rc.
|
245
|
+
Ember.VERSION = '1.0.0-rc.3';
|
246
246
|
|
247
247
|
/**
|
248
248
|
Standard environmental variables. You can define these in a global `ENV`
|
@@ -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) {
|
@@ -634,62 +641,6 @@ if (Ember.ENV.MANDATORY_SETTER && !platform.hasPropertyAccessors) {
|
|
634
641
|
|
635
642
|
|
636
643
|
|
637
|
-
(function() {
|
638
|
-
var utils = Ember.EnumerableUtils = {
|
639
|
-
map: function(obj, callback, thisArg) {
|
640
|
-
return obj.map ? obj.map.call(obj, callback, thisArg) : Array.prototype.map.call(obj, callback, thisArg);
|
641
|
-
},
|
642
|
-
|
643
|
-
forEach: function(obj, callback, thisArg) {
|
644
|
-
return obj.forEach ? obj.forEach.call(obj, callback, thisArg) : Array.prototype.forEach.call(obj, callback, thisArg);
|
645
|
-
},
|
646
|
-
|
647
|
-
indexOf: function(obj, element, index) {
|
648
|
-
return obj.indexOf ? obj.indexOf.call(obj, element, index) : Array.prototype.indexOf.call(obj, element, index);
|
649
|
-
},
|
650
|
-
|
651
|
-
indexesOf: function(obj, elements) {
|
652
|
-
return elements === undefined ? [] : utils.map(elements, function(item) {
|
653
|
-
return utils.indexOf(obj, item);
|
654
|
-
});
|
655
|
-
},
|
656
|
-
|
657
|
-
addObject: function(array, item) {
|
658
|
-
var index = utils.indexOf(array, item);
|
659
|
-
if (index === -1) { array.push(item); }
|
660
|
-
},
|
661
|
-
|
662
|
-
removeObject: function(array, item) {
|
663
|
-
var index = utils.indexOf(array, item);
|
664
|
-
if (index !== -1) { array.splice(index, 1); }
|
665
|
-
},
|
666
|
-
|
667
|
-
replace: function(array, idx, amt, objects) {
|
668
|
-
if (array.replace) {
|
669
|
-
return array.replace(idx, amt, objects);
|
670
|
-
} else {
|
671
|
-
var args = Array.prototype.concat.apply([idx, amt], objects);
|
672
|
-
return array.splice.apply(array, args);
|
673
|
-
}
|
674
|
-
},
|
675
|
-
|
676
|
-
intersection: function(array1, array2) {
|
677
|
-
var intersection = [];
|
678
|
-
|
679
|
-
array1.forEach(function(element) {
|
680
|
-
if (array2.indexOf(element) >= 0) {
|
681
|
-
intersection.push(element);
|
682
|
-
}
|
683
|
-
});
|
684
|
-
|
685
|
-
return intersection;
|
686
|
-
}
|
687
|
-
};
|
688
|
-
|
689
|
-
})();
|
690
|
-
|
691
|
-
|
692
|
-
|
693
644
|
(function() {
|
694
645
|
/*jshint newcap:false*/
|
695
646
|
/**
|
@@ -1566,6 +1517,68 @@ Ember.subscribe = Ember.Instrumentation.subscribe;
|
|
1566
1517
|
|
1567
1518
|
|
1568
1519
|
|
1520
|
+
(function() {
|
1521
|
+
var map, forEach, indexOf, concat;
|
1522
|
+
concat = Array.prototype.concat;
|
1523
|
+
map = Array.prototype.map || Ember.ArrayPolyfills.map;
|
1524
|
+
forEach = Array.prototype.forEach || Ember.ArrayPolyfills.forEach;
|
1525
|
+
indexOf = Array.prototype.indexOf || Ember.ArrayPolyfills.indexOf;
|
1526
|
+
|
1527
|
+
var utils = Ember.EnumerableUtils = {
|
1528
|
+
map: function(obj, callback, thisArg) {
|
1529
|
+
return obj.map ? obj.map.call(obj, callback, thisArg) : map.call(obj, callback, thisArg);
|
1530
|
+
},
|
1531
|
+
|
1532
|
+
forEach: function(obj, callback, thisArg) {
|
1533
|
+
return obj.forEach ? obj.forEach.call(obj, callback, thisArg) : forEach.call(obj, callback, thisArg);
|
1534
|
+
},
|
1535
|
+
|
1536
|
+
indexOf: function(obj, element, index) {
|
1537
|
+
return obj.indexOf ? obj.indexOf.call(obj, element, index) : indexOf.call(obj, element, index);
|
1538
|
+
},
|
1539
|
+
|
1540
|
+
indexesOf: function(obj, elements) {
|
1541
|
+
return elements === undefined ? [] : utils.map(elements, function(item) {
|
1542
|
+
return utils.indexOf(obj, item);
|
1543
|
+
});
|
1544
|
+
},
|
1545
|
+
|
1546
|
+
addObject: function(array, item) {
|
1547
|
+
var index = utils.indexOf(array, item);
|
1548
|
+
if (index === -1) { array.push(item); }
|
1549
|
+
},
|
1550
|
+
|
1551
|
+
removeObject: function(array, item) {
|
1552
|
+
var index = utils.indexOf(array, item);
|
1553
|
+
if (index !== -1) { array.splice(index, 1); }
|
1554
|
+
},
|
1555
|
+
|
1556
|
+
replace: function(array, idx, amt, objects) {
|
1557
|
+
if (array.replace) {
|
1558
|
+
return array.replace(idx, amt, objects);
|
1559
|
+
} else {
|
1560
|
+
var args = concat.apply([idx, amt], objects);
|
1561
|
+
return array.splice.apply(array, args);
|
1562
|
+
}
|
1563
|
+
},
|
1564
|
+
|
1565
|
+
intersection: function(array1, array2) {
|
1566
|
+
var intersection = [];
|
1567
|
+
|
1568
|
+
utils.forEach(array1, function(element) {
|
1569
|
+
if (utils.indexOf(array2, element) >= 0) {
|
1570
|
+
intersection.push(element);
|
1571
|
+
}
|
1572
|
+
});
|
1573
|
+
|
1574
|
+
return intersection;
|
1575
|
+
}
|
1576
|
+
};
|
1577
|
+
|
1578
|
+
})();
|
1579
|
+
|
1580
|
+
|
1581
|
+
|
1569
1582
|
(function() {
|
1570
1583
|
/**
|
1571
1584
|
@module ember-metal
|
@@ -1705,7 +1718,7 @@ OrderedSet.prototype = {
|
|
1705
1718
|
*/
|
1706
1719
|
forEach: function(fn, self) {
|
1707
1720
|
// allow mutation during iteration
|
1708
|
-
var list = this.
|
1721
|
+
var list = this.toArray();
|
1709
1722
|
|
1710
1723
|
for (var i = 0, j = list.length; i < j; i++) {
|
1711
1724
|
fn.call(self, list[i]);
|
@@ -1728,7 +1741,7 @@ OrderedSet.prototype = {
|
|
1728
1741
|
var set = new OrderedSet();
|
1729
1742
|
|
1730
1743
|
set.presenceSet = copy(this.presenceSet);
|
1731
|
-
set.list = this.
|
1744
|
+
set.list = this.toArray();
|
1732
1745
|
|
1733
1746
|
return set;
|
1734
1747
|
}
|
@@ -1811,12 +1824,10 @@ Map.prototype = {
|
|
1811
1824
|
// to use in browsers that are not ES6 friendly;
|
1812
1825
|
var keys = this.keys,
|
1813
1826
|
values = this.values,
|
1814
|
-
guid = guidFor(key)
|
1815
|
-
value;
|
1827
|
+
guid = guidFor(key);
|
1816
1828
|
|
1817
1829
|
if (values.hasOwnProperty(guid)) {
|
1818
1830
|
keys.remove(key);
|
1819
|
-
value = values[guid];
|
1820
1831
|
delete values[guid];
|
1821
1832
|
return true;
|
1822
1833
|
} else {
|
@@ -1988,13 +1999,12 @@ get = function get(obj, keyName) {
|
|
1988
1999
|
obj = null;
|
1989
2000
|
}
|
1990
2001
|
|
1991
|
-
|
1992
|
-
|
2002
|
+
Ember.assert("Cannot call get with '"+ keyName +"' on an undefined object.", obj !== undefined);
|
2003
|
+
|
2004
|
+
if (obj === null || keyName.indexOf('.') !== -1) {
|
1993
2005
|
return getPath(obj, keyName);
|
1994
2006
|
}
|
1995
2007
|
|
1996
|
-
Ember.assert("You need to provide an object and key to `get`.", !!obj && keyName);
|
1997
|
-
|
1998
2008
|
var meta = obj[META_KEY], desc = meta && meta.descs[keyName], ret;
|
1999
2009
|
if (desc) {
|
2000
2010
|
return desc.get(obj, keyName);
|
@@ -2066,7 +2076,7 @@ var getPath = Ember._getPath = function(root, path) {
|
|
2066
2076
|
|
2067
2077
|
parts = path.split(".");
|
2068
2078
|
len = parts.length;
|
2069
|
-
for (idx=0; root && idx<len; idx++) {
|
2079
|
+
for (idx=0; root !== undefined && root !== null && idx<len; idx++) {
|
2070
2080
|
root = get(root, parts[idx], true);
|
2071
2081
|
if (root && root.isDestroyed) { return undefined; }
|
2072
2082
|
}
|
@@ -2112,7 +2122,9 @@ Ember.getPath = Ember.deprecateFunc('getPath is deprecated since get now support
|
|
2112
2122
|
|
2113
2123
|
var o_create = Ember.create,
|
2114
2124
|
metaFor = Ember.meta,
|
2115
|
-
META_KEY = Ember.META_KEY
|
2125
|
+
META_KEY = Ember.META_KEY,
|
2126
|
+
/* listener flags */
|
2127
|
+
ONCE = 1, SUSPENDED = 2, IMMEDIATE = 4;
|
2116
2128
|
|
2117
2129
|
/*
|
2118
2130
|
The event system uses a series of nested hashes to store listeners on an
|
@@ -2125,7 +2137,7 @@ var o_create = Ember.create,
|
|
2125
2137
|
{
|
2126
2138
|
listeners: { // variable name: `listenerSet`
|
2127
2139
|
"foo:changed": [ // variable name: `actions`
|
2128
|
-
[target, method,
|
2140
|
+
[target, method, flags]
|
2129
2141
|
]
|
2130
2142
|
}
|
2131
2143
|
}
|
@@ -2171,12 +2183,11 @@ function actionsUnion(obj, eventName, otherActions) {
|
|
2171
2183
|
for (var i = actions.length - 1; i >= 0; i--) {
|
2172
2184
|
var target = actions[i][0],
|
2173
2185
|
method = actions[i][1],
|
2174
|
-
|
2175
|
-
suspended = actions[i][3],
|
2186
|
+
flags = actions[i][2],
|
2176
2187
|
actionIndex = indexOf(otherActions, target, method);
|
2177
2188
|
|
2178
2189
|
if (actionIndex === -1) {
|
2179
|
-
otherActions.push([target, method,
|
2190
|
+
otherActions.push([target, method, flags]);
|
2180
2191
|
}
|
2181
2192
|
}
|
2182
2193
|
}
|
@@ -2190,14 +2201,13 @@ function actionsDiff(obj, eventName, otherActions) {
|
|
2190
2201
|
for (var i = actions.length - 1; i >= 0; i--) {
|
2191
2202
|
var target = actions[i][0],
|
2192
2203
|
method = actions[i][1],
|
2193
|
-
|
2194
|
-
suspended = actions[i][3],
|
2204
|
+
flags = actions[i][2],
|
2195
2205
|
actionIndex = indexOf(otherActions, target, method);
|
2196
2206
|
|
2197
2207
|
if (actionIndex !== -1) { continue; }
|
2198
2208
|
|
2199
|
-
otherActions.push([target, method,
|
2200
|
-
diffActions.push([target, method,
|
2209
|
+
otherActions.push([target, method, flags]);
|
2210
|
+
diffActions.push([target, method, flags]);
|
2201
2211
|
}
|
2202
2212
|
|
2203
2213
|
return diffActions;
|
@@ -2223,11 +2233,14 @@ function addListener(obj, eventName, target, method, once) {
|
|
2223
2233
|
}
|
2224
2234
|
|
2225
2235
|
var actions = actionsFor(obj, eventName),
|
2226
|
-
actionIndex = indexOf(actions, target, method)
|
2236
|
+
actionIndex = indexOf(actions, target, method),
|
2237
|
+
flags = 0;
|
2238
|
+
|
2239
|
+
if (once) flags |= ONCE;
|
2227
2240
|
|
2228
2241
|
if (actionIndex !== -1) { return; }
|
2229
2242
|
|
2230
|
-
actions.push([target, method,
|
2243
|
+
actions.push([target, method, flags]);
|
2231
2244
|
|
2232
2245
|
if ('function' === typeof obj.didAddListener) {
|
2233
2246
|
obj.didAddListener(eventName, target, method);
|
@@ -2254,7 +2267,7 @@ function removeListener(obj, eventName, target, method) {
|
|
2254
2267
|
target = null;
|
2255
2268
|
}
|
2256
2269
|
|
2257
|
-
function _removeListener(target, method
|
2270
|
+
function _removeListener(target, method) {
|
2258
2271
|
var actions = actionsFor(obj, eventName),
|
2259
2272
|
actionIndex = indexOf(actions, target, method);
|
2260
2273
|
|
@@ -2311,12 +2324,12 @@ function suspendListener(obj, eventName, target, method, callback) {
|
|
2311
2324
|
|
2312
2325
|
if (actionIndex !== -1) {
|
2313
2326
|
action = actions[actionIndex].slice(); // copy it, otherwise we're modifying a shared object
|
2314
|
-
action[
|
2327
|
+
action[2] |= SUSPENDED; // mark the action as suspended
|
2315
2328
|
actions[actionIndex] = action; // replace the shared object with our copy
|
2316
2329
|
}
|
2317
2330
|
|
2318
2331
|
function tryable() { return callback.call(target); }
|
2319
|
-
function finalizer() { if (action) { action[
|
2332
|
+
function finalizer() { if (action) { action[2] &= ~SUSPENDED; } }
|
2320
2333
|
|
2321
2334
|
return Ember.tryFinally(tryable, finalizer);
|
2322
2335
|
}
|
@@ -2355,7 +2368,7 @@ function suspendListeners(obj, eventNames, target, method, callback) {
|
|
2355
2368
|
|
2356
2369
|
if (actionIndex !== -1) {
|
2357
2370
|
action = actions[actionIndex].slice();
|
2358
|
-
action[
|
2371
|
+
action[2] |= SUSPENDED;
|
2359
2372
|
actions[actionIndex] = action;
|
2360
2373
|
suspendedActions.push(action);
|
2361
2374
|
}
|
@@ -2365,7 +2378,7 @@ function suspendListeners(obj, eventNames, target, method, callback) {
|
|
2365
2378
|
|
2366
2379
|
function finalizer() {
|
2367
2380
|
for (i = 0, l = suspendedActions.length; i < l; i++) {
|
2368
|
-
suspendedActions[i][
|
2381
|
+
suspendedActions[i][2] &= ~SUSPENDED;
|
2369
2382
|
}
|
2370
2383
|
}
|
2371
2384
|
|
@@ -2415,13 +2428,11 @@ function sendEvent(obj, eventName, params, actions) {
|
|
2415
2428
|
if (!actions) { return; }
|
2416
2429
|
|
2417
2430
|
for (var i = actions.length - 1; i >= 0; i--) { // looping in reverse for once listeners
|
2418
|
-
|
2419
|
-
|
2420
|
-
var target =
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
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); }
|
2425
2436
|
if (!target) { target = obj; }
|
2426
2437
|
if ('string' === typeof method) { method = target[method]; }
|
2427
2438
|
if (params) {
|
@@ -2501,7 +2512,7 @@ var guidFor = Ember.guidFor,
|
|
2501
2512
|
keyName: keyName,
|
2502
2513
|
eventName: eventName,
|
2503
2514
|
listeners: [
|
2504
|
-
[target, method,
|
2515
|
+
[target, method, flags]
|
2505
2516
|
]
|
2506
2517
|
},
|
2507
2518
|
...
|
@@ -2775,8 +2786,6 @@ var notifyObservers = function(obj, keyName) {
|
|
2775
2786
|
var META_KEY = Ember.META_KEY,
|
2776
2787
|
MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER,
|
2777
2788
|
IS_GLOBAL = /^([A-Z$]|([0-9][A-Z$]))/,
|
2778
|
-
propertyWillChange = Ember.propertyWillChange,
|
2779
|
-
propertyDidChange = Ember.propertyDidChange,
|
2780
2789
|
getPath = Ember._getPath;
|
2781
2790
|
|
2782
2791
|
/**
|
@@ -2931,7 +2940,7 @@ var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;
|
|
2931
2940
|
//
|
2932
2941
|
|
2933
2942
|
/**
|
2934
|
-
Objects of this type can implement an interface to
|
2943
|
+
Objects of this type can implement an interface to respond to requests to
|
2935
2944
|
get and set. The default implementation handles simple properties.
|
2936
2945
|
|
2937
2946
|
You generally won't need to create or subclass this directly.
|
@@ -3236,7 +3245,6 @@ function isProto(pvalue) {
|
|
3236
3245
|
// value for the key then the node won't actually watch it. For a root node
|
3237
3246
|
// pass null for parent and key and object for value.
|
3238
3247
|
var ChainNode = Ember._ChainNode = function(parent, key, value) {
|
3239
|
-
var obj;
|
3240
3248
|
this._parent = parent;
|
3241
3249
|
this._key = key;
|
3242
3250
|
|
@@ -3685,7 +3693,7 @@ var get = Ember.get,
|
|
3685
3693
|
This function returns a map of unique dependencies for a
|
3686
3694
|
given object and key.
|
3687
3695
|
*/
|
3688
|
-
function keysForDep(
|
3696
|
+
function keysForDep(depsMeta, depKey) {
|
3689
3697
|
var keys = depsMeta[depKey];
|
3690
3698
|
if (!keys) {
|
3691
3699
|
// if there are no dependencies yet for a the given key
|
@@ -3699,8 +3707,8 @@ function keysForDep(obj, depsMeta, depKey) {
|
|
3699
3707
|
return keys;
|
3700
3708
|
}
|
3701
3709
|
|
3702
|
-
function metaForDeps(
|
3703
|
-
return keysForDep(
|
3710
|
+
function metaForDeps(meta) {
|
3711
|
+
return keysForDep(meta, 'deps');
|
3704
3712
|
}
|
3705
3713
|
|
3706
3714
|
function addDependentKeys(desc, obj, keyName, meta) {
|
@@ -3709,12 +3717,12 @@ function addDependentKeys(desc, obj, keyName, meta) {
|
|
3709
3717
|
var depKeys = desc._dependentKeys, depsMeta, idx, len, depKey, keys;
|
3710
3718
|
if (!depKeys) return;
|
3711
3719
|
|
3712
|
-
depsMeta = metaForDeps(
|
3720
|
+
depsMeta = metaForDeps(meta);
|
3713
3721
|
|
3714
3722
|
for(idx = 0, len = depKeys.length; idx < len; idx++) {
|
3715
3723
|
depKey = depKeys[idx];
|
3716
3724
|
// Lookup keys meta for depKey
|
3717
|
-
keys = keysForDep(
|
3725
|
+
keys = keysForDep(depsMeta, depKey);
|
3718
3726
|
// Increment the number of times depKey depends on keyName.
|
3719
3727
|
keys[keyName] = (keys[keyName] || 0) + 1;
|
3720
3728
|
// Watch the depKey
|
@@ -3728,12 +3736,12 @@ function removeDependentKeys(desc, obj, keyName, meta) {
|
|
3728
3736
|
var depKeys = desc._dependentKeys, depsMeta, idx, len, depKey, keys;
|
3729
3737
|
if (!depKeys) return;
|
3730
3738
|
|
3731
|
-
depsMeta = metaForDeps(
|
3739
|
+
depsMeta = metaForDeps(meta);
|
3732
3740
|
|
3733
3741
|
for(idx = 0, len = depKeys.length; idx < len; idx++) {
|
3734
3742
|
depKey = depKeys[idx];
|
3735
3743
|
// Lookup keys meta for depKey
|
3736
|
-
keys = keysForDep(
|
3744
|
+
keys = keysForDep(depsMeta, depKey);
|
3737
3745
|
// Increment the number of times depKey depends on keyName.
|
3738
3746
|
keys[keyName] = (keys[keyName] || 0) - 1;
|
3739
3747
|
// Watch the depKey
|
@@ -3764,25 +3772,29 @@ ComputedProperty.prototype = new Ember.Descriptor();
|
|
3764
3772
|
|
3765
3773
|
var ComputedPropertyPrototype = ComputedProperty.prototype;
|
3766
3774
|
|
3767
|
-
|
3768
|
-
Call on a computed property to
|
3769
|
-
|
3770
|
-
|
3775
|
+
/*
|
3776
|
+
Call on a computed property to explicitly change it's cacheable mode.
|
3777
|
+
|
3778
|
+
Please use `.volatile` over this method.
|
3771
3779
|
|
3772
3780
|
```javascript
|
3773
3781
|
MyApp.president = Ember.Object.create({
|
3774
3782
|
fullName: function() {
|
3775
3783
|
return this.get('firstName') + ' ' + this.get('lastName');
|
3776
3784
|
|
3777
|
-
//
|
3778
|
-
//
|
3779
|
-
// one of the dependent properties change.
|
3785
|
+
// By default, Ember will return the value of this property
|
3786
|
+
// without re-executing this function.
|
3780
3787
|
}.property('firstName', 'lastName')
|
3788
|
+
|
3789
|
+
initials: function() {
|
3790
|
+
return this.get('firstName')[0] + this.get('lastName')[0];
|
3791
|
+
|
3792
|
+
// This function will be executed every time this property
|
3793
|
+
// is requested.
|
3794
|
+
}.property('firstName', 'lastName').cacheable(false)
|
3781
3795
|
});
|
3782
3796
|
```
|
3783
3797
|
|
3784
|
-
Properties are cacheable by default.
|
3785
|
-
|
3786
3798
|
@method cacheable
|
3787
3799
|
@param {Boolean} aFlag optional set to `false` to disable caching
|
3788
3800
|
@return {Ember.ComputedProperty} this
|
@@ -4346,7 +4358,6 @@ Ember.computed.alias = function(dependentKey) {
|
|
4346
4358
|
*/
|
4347
4359
|
Ember.computed.defaultTo = function(defaultPath) {
|
4348
4360
|
return Ember.computed(function(key, newValue, cachedValue) {
|
4349
|
-
var result;
|
4350
4361
|
if (arguments.length === 1) {
|
4351
4362
|
return cachedValue != null ? cachedValue : get(this, defaultPath);
|
4352
4363
|
}
|
@@ -4506,8 +4517,6 @@ function invoke(target, method, args, ignore) {
|
|
4506
4517
|
// RUNLOOP
|
4507
4518
|
//
|
4508
4519
|
|
4509
|
-
var timerMark; // used by timers...
|
4510
|
-
|
4511
4520
|
/**
|
4512
4521
|
Ember RunLoop (Private)
|
4513
4522
|
|
@@ -4638,8 +4647,6 @@ RunLoop.prototype = {
|
|
4638
4647
|
}
|
4639
4648
|
}
|
4640
4649
|
|
4641
|
-
timerMark = null;
|
4642
|
-
|
4643
4650
|
return this;
|
4644
4651
|
}
|
4645
4652
|
|
@@ -4755,7 +4762,7 @@ Ember.run.queues = ['sync', 'actions', 'destroy'];
|
|
4755
4762
|
|
4756
4763
|
At the end of a RunLoop, any methods scheduled in this way will be invoked.
|
4757
4764
|
Methods will be invoked in an order matching the named queues defined in
|
4758
|
-
the `run.queues` property.
|
4765
|
+
the `Ember.run.queues` property.
|
4759
4766
|
|
4760
4767
|
```javascript
|
4761
4768
|
Ember.run.schedule('sync', this, function(){
|
@@ -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
|
});
|
@@ -4986,8 +5010,25 @@ function scheduleOnce(queue, target, method, args) {
|
|
4986
5010
|
}
|
4987
5011
|
|
4988
5012
|
/**
|
4989
|
-
|
4990
|
-
|
5013
|
+
Schedule a function to run one time during the current RunLoop. This is equivalent
|
5014
|
+
to calling `scheduleOnce` with the "actions" queue.
|
5015
|
+
|
5016
|
+
@method once
|
5017
|
+
@param {Object} [target] The target of the method to invoke.
|
5018
|
+
@param {Function|String} method The method to invoke.
|
5019
|
+
If you pass a string it will be resolved on the
|
5020
|
+
target at the time the method is invoked.
|
5021
|
+
@param {Object} [args*] Optional arguments to pass to the timeout.
|
5022
|
+
@return {Object} timer
|
5023
|
+
*/
|
5024
|
+
Ember.run.once = function(target, method) {
|
5025
|
+
return scheduleOnce('actions', target, method, slice.call(arguments, 2));
|
5026
|
+
};
|
5027
|
+
|
5028
|
+
/**
|
5029
|
+
Schedules a function to run one time in a given queue of the current RunLoop.
|
5030
|
+
Calling this method with the same queue/target/method combination will have
|
5031
|
+
no effect (past the initial call).
|
4991
5032
|
|
4992
5033
|
Note that although you can pass optional arguments these will not be
|
4993
5034
|
considered when looking for duplicates. New arguments will replace previous
|
@@ -4995,41 +5036,40 @@ function scheduleOnce(queue, target, method, args) {
|
|
4995
5036
|
|
4996
5037
|
```javascript
|
4997
5038
|
Ember.run(function(){
|
4998
|
-
var
|
4999
|
-
Ember.run.
|
5000
|
-
Ember.run.
|
5001
|
-
// doFoo will only be executed once
|
5039
|
+
var sayHi = function() { console.log('hi'); }
|
5040
|
+
Ember.run.scheduleOnce('afterRender', myContext, sayHi);
|
5041
|
+
Ember.run.scheduleOnce('afterRender', myContext, sayHi);
|
5042
|
+
// doFoo will only be executed once, in the afterRender queue of the RunLoop
|
5002
5043
|
});
|
5003
5044
|
```
|
5004
5045
|
|
5005
|
-
Also note that passing an anonymous function to `Ember.run.
|
5046
|
+
Also note that passing an anonymous function to `Ember.run.scheduleOnce` will
|
5006
5047
|
not prevent additional calls with an identical anonymous function from
|
5007
5048
|
scheduling the items multiple times, e.g.:
|
5008
5049
|
|
5009
5050
|
```javascript
|
5010
5051
|
function scheduleIt() {
|
5011
|
-
Ember.run.
|
5052
|
+
Ember.run.scheduleOnce('actions', myContext, function() { console.log("Closure"); });
|
5012
5053
|
}
|
5013
5054
|
scheduleIt();
|
5014
5055
|
scheduleIt();
|
5015
|
-
// "Closure" will print twice, even though we're using `Ember.run.
|
5056
|
+
// "Closure" will print twice, even though we're using `Ember.run.scheduleOnce`,
|
5016
5057
|
// because the function we pass to it is anonymous and won't match the
|
5017
5058
|
// previously scheduled operation.
|
5018
5059
|
```
|
5019
5060
|
|
5020
|
-
|
5021
|
-
|
5061
|
+
Available queues, and their order, can be found at `Ember.run.queues`
|
5062
|
+
|
5063
|
+
@method scheduleOnce
|
5064
|
+
@param {String} [queue] The name of the queue to schedule against. Default queues are 'sync' and 'actions'.
|
5065
|
+
@param {Object} [target] The target of the method to invoke.
|
5022
5066
|
@param {Function|String} method The method to invoke.
|
5023
5067
|
If you pass a string it will be resolved on the
|
5024
5068
|
target at the time the method is invoked.
|
5025
5069
|
@param {Object} [args*] Optional arguments to pass to the timeout.
|
5026
5070
|
@return {Object} timer
|
5027
5071
|
*/
|
5028
|
-
Ember.run.
|
5029
|
-
return scheduleOnce('actions', target, method, slice.call(arguments, 2));
|
5030
|
-
};
|
5031
|
-
|
5032
|
-
Ember.run.scheduleOnce = function(queue, target, method, args) {
|
5072
|
+
Ember.run.scheduleOnce = function(queue, target, method) {
|
5033
5073
|
return scheduleOnce(queue, target, method, slice.call(arguments, 3));
|
5034
5074
|
};
|
5035
5075
|
|
@@ -5465,7 +5505,7 @@ mixinProperties(Binding, {
|
|
5465
5505
|
Properties ending in a `Binding` suffix will be converted to `Ember.Binding`
|
5466
5506
|
instances. The value of this property should be a string representing a path
|
5467
5507
|
to another object or a custom binding instanced created using Binding helpers
|
5468
|
-
(see "
|
5508
|
+
(see "One Way Bindings"):
|
5469
5509
|
|
5470
5510
|
```
|
5471
5511
|
valueBinding: "MyApp.someController.title"
|
@@ -6204,7 +6244,7 @@ Ember.alias = function(methodName) {
|
|
6204
6244
|
return new Alias(methodName);
|
6205
6245
|
};
|
6206
6246
|
|
6207
|
-
Ember.deprecateFunc("Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead.", Ember.alias);
|
6247
|
+
Ember.alias = Ember.deprecateFunc("Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead.", Ember.alias);
|
6208
6248
|
|
6209
6249
|
/**
|
6210
6250
|
Makes a method available via an additional name.
|
@@ -6292,14 +6332,57 @@ Ember Metal
|
|
6292
6332
|
})();
|
6293
6333
|
|
6294
6334
|
(function() {
|
6295
|
-
define("rsvp",
|
6296
|
-
[],
|
6297
|
-
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__) {
|
6298
6381
|
"use strict";
|
6299
6382
|
var browserGlobal = (typeof window !== 'undefined') ? window : {};
|
6300
6383
|
|
6301
|
-
var
|
6302
|
-
var
|
6384
|
+
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
|
6385
|
+
var async;
|
6303
6386
|
|
6304
6387
|
if (typeof process !== 'undefined' &&
|
6305
6388
|
{}.toString.call(process) === '[object process]') {
|
@@ -6308,10 +6391,10 @@ define("rsvp",
|
|
6308
6391
|
callback.call(binding);
|
6309
6392
|
});
|
6310
6393
|
};
|
6311
|
-
} else if (
|
6394
|
+
} else if (BrowserMutationObserver) {
|
6312
6395
|
var queue = [];
|
6313
6396
|
|
6314
|
-
var observer = new
|
6397
|
+
var observer = new BrowserMutationObserver(function() {
|
6315
6398
|
var toProcess = queue.slice();
|
6316
6399
|
queue = [];
|
6317
6400
|
|
@@ -6342,6 +6425,47 @@ define("rsvp",
|
|
6342
6425
|
};
|
6343
6426
|
}
|
6344
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";
|
6345
6469
|
var Event = function(type, options) {
|
6346
6470
|
this.type = type;
|
6347
6471
|
|
@@ -6436,7 +6560,148 @@ define("rsvp",
|
|
6436
6560
|
}
|
6437
6561
|
};
|
6438
6562
|
|
6439
|
-
|
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
|
+
|
6440
6705
|
this.on('promise:resolved', function(event) {
|
6441
6706
|
this.trigger('success', { detail: event.detail });
|
6442
6707
|
}, this);
|
@@ -6444,12 +6709,12 @@ define("rsvp",
|
|
6444
6709
|
this.on('promise:failed', function(event) {
|
6445
6710
|
this.trigger('error', { detail: event.detail });
|
6446
6711
|
}, this);
|
6447
|
-
};
|
6448
6712
|
|
6449
|
-
|
6713
|
+
resolver(resolvePromise, rejectPromise);
|
6714
|
+
};
|
6450
6715
|
|
6451
6716
|
var invokeCallback = function(type, promise, callback, event) {
|
6452
|
-
var hasCallback =
|
6717
|
+
var hasCallback = isFunction(callback),
|
6453
6718
|
value, error, succeeded, failed;
|
6454
6719
|
|
6455
6720
|
if (hasCallback) {
|
@@ -6465,34 +6730,34 @@ define("rsvp",
|
|
6465
6730
|
succeeded = true;
|
6466
6731
|
}
|
6467
6732
|
|
6468
|
-
if (
|
6469
|
-
|
6470
|
-
promise.resolve(value);
|
6471
|
-
}, function(error) {
|
6472
|
-
promise.reject(error);
|
6473
|
-
});
|
6733
|
+
if (handleThenable(promise, value)) {
|
6734
|
+
return;
|
6474
6735
|
} else if (hasCallback && succeeded) {
|
6475
|
-
|
6736
|
+
resolve(promise, value);
|
6476
6737
|
} else if (failed) {
|
6477
|
-
|
6478
|
-
} else {
|
6479
|
-
promise
|
6738
|
+
reject(promise, error);
|
6739
|
+
} else if (type === 'resolve') {
|
6740
|
+
resolve(promise, value);
|
6741
|
+
} else if (type === 'reject') {
|
6742
|
+
reject(promise, value);
|
6480
6743
|
}
|
6481
6744
|
};
|
6482
6745
|
|
6483
6746
|
Promise.prototype = {
|
6747
|
+
constructor: Promise,
|
6748
|
+
|
6484
6749
|
then: function(done, fail) {
|
6485
|
-
var thenPromise = new Promise();
|
6750
|
+
var thenPromise = new Promise(function() {});
|
6486
6751
|
|
6487
|
-
if (this.
|
6488
|
-
|
6489
|
-
invokeCallback('resolve', thenPromise, done, { detail: this.
|
6752
|
+
if (this.isFulfilled) {
|
6753
|
+
config.async(function() {
|
6754
|
+
invokeCallback('resolve', thenPromise, done, { detail: this.fulfillmentValue });
|
6490
6755
|
}, this);
|
6491
6756
|
}
|
6492
6757
|
|
6493
6758
|
if (this.isRejected) {
|
6494
|
-
|
6495
|
-
invokeCallback('reject', thenPromise, fail, { detail: this.
|
6759
|
+
config.async(function() {
|
6760
|
+
invokeCallback('reject', thenPromise, fail, { detail: this.rejectedReason });
|
6496
6761
|
}, this);
|
6497
6762
|
}
|
6498
6763
|
|
@@ -6505,75 +6770,138 @@ define("rsvp",
|
|
6505
6770
|
});
|
6506
6771
|
|
6507
6772
|
return thenPromise;
|
6508
|
-
}
|
6773
|
+
}
|
6774
|
+
};
|
6509
6775
|
|
6510
|
-
|
6511
|
-
resolve(this, value);
|
6776
|
+
EventTarget.mixin(Promise.prototype);
|
6512
6777
|
|
6513
|
-
|
6514
|
-
|
6515
|
-
|
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
|
+
}
|
6516
6785
|
|
6517
|
-
|
6518
|
-
|
6786
|
+
function handleThenable(promise, value) {
|
6787
|
+
var then = null;
|
6519
6788
|
|
6520
|
-
|
6521
|
-
|
6789
|
+
if (objectOrFunction(value)) {
|
6790
|
+
try {
|
6791
|
+
then = value.then;
|
6792
|
+
} catch(e) {
|
6793
|
+
reject(promise, e);
|
6794
|
+
return true;
|
6795
|
+
}
|
6796
|
+
|
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
|
+
}
|
6522
6813
|
}
|
6523
|
-
};
|
6524
6814
|
|
6525
|
-
|
6526
|
-
|
6815
|
+
return false;
|
6816
|
+
}
|
6817
|
+
|
6818
|
+
function fulfill(promise, value) {
|
6819
|
+
config.async(function() {
|
6527
6820
|
promise.trigger('promise:resolved', { detail: value });
|
6528
|
-
promise.
|
6529
|
-
promise.
|
6821
|
+
promise.isFulfilled = true;
|
6822
|
+
promise.fulfillmentValue = value;
|
6530
6823
|
});
|
6531
6824
|
}
|
6532
6825
|
|
6533
6826
|
function reject(promise, value) {
|
6534
|
-
|
6827
|
+
config.async(function() {
|
6535
6828
|
promise.trigger('promise:failed', { detail: value });
|
6536
6829
|
promise.isRejected = true;
|
6537
|
-
promise.
|
6830
|
+
promise.rejectedReason = value;
|
6538
6831
|
});
|
6539
6832
|
}
|
6540
6833
|
|
6541
|
-
function all(promises) {
|
6542
|
-
var i, results = [];
|
6543
|
-
var allPromise = new Promise();
|
6544
|
-
var remaining = promises.length;
|
6545
6834
|
|
6546
|
-
|
6547
|
-
|
6548
|
-
}
|
6835
|
+
__exports__.Promise = Promise;
|
6836
|
+
});
|
6549
6837
|
|
6550
|
-
|
6551
|
-
|
6552
|
-
|
6553
|
-
|
6554
|
-
|
6838
|
+
define("rsvp/resolve",
|
6839
|
+
["rsvp/promise","exports"],
|
6840
|
+
function(__dependency1__, __exports__) {
|
6841
|
+
"use strict";
|
6842
|
+
var Promise = __dependency1__.Promise;
|
6555
6843
|
|
6556
|
-
var resolve = function(index, value) {
|
6557
|
-
results[index] = value;
|
6558
|
-
if (--remaining === 0) {
|
6559
|
-
allPromise.resolve(results);
|
6560
|
-
}
|
6561
|
-
};
|
6562
6844
|
|
6563
|
-
|
6564
|
-
|
6565
|
-
|
6845
|
+
function objectOrFunction(x) {
|
6846
|
+
return typeof x === "function" || (typeof x === "object" && x !== null);
|
6847
|
+
}
|
6566
6848
|
|
6567
|
-
|
6568
|
-
|
6569
|
-
|
6570
|
-
|
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;
|
6571
6873
|
}
|
6572
6874
|
|
6573
|
-
EventTarget.mixin(Promise.prototype);
|
6574
6875
|
|
6575
|
-
|
6576
|
-
|
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;
|
6577
6905
|
});
|
6578
6906
|
|
6579
6907
|
})();
|
@@ -6819,7 +7147,7 @@ define("container",
|
|
6819
7147
|
var factory = factoryFor(container, fullName);
|
6820
7148
|
|
6821
7149
|
var splitName = fullName.split(":"),
|
6822
|
-
type = splitName[0],
|
7150
|
+
type = splitName[0],
|
6823
7151
|
value;
|
6824
7152
|
|
6825
7153
|
if (option(container, fullName, 'instantiate') === false) {
|
@@ -7228,7 +7556,8 @@ Ember.String = {
|
|
7228
7556
|
```
|
7229
7557
|
|
7230
7558
|
@method fmt
|
7231
|
-
@param {
|
7559
|
+
@param {String} str The string to format
|
7560
|
+
@param {Array} formats An array of parameters to interpolate into string.
|
7232
7561
|
@return {String} formatted string
|
7233
7562
|
*/
|
7234
7563
|
fmt: function(str, formats) {
|
@@ -8558,9 +8887,7 @@ Ember.Enumerable = Ember.Mixin.create({
|
|
8558
8887
|
// HELPERS
|
8559
8888
|
//
|
8560
8889
|
|
8561
|
-
var get = Ember.get, set = Ember.set, map = Ember.EnumerableUtils.map, cacheFor = Ember.cacheFor;
|
8562
|
-
|
8563
|
-
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;
|
8564
8891
|
|
8565
8892
|
// ..........................................................
|
8566
8893
|
// ARRAY
|
@@ -8710,8 +9037,8 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
|
|
8710
9037
|
slice: function(beginIndex, endIndex) {
|
8711
9038
|
var ret = Ember.A([]);
|
8712
9039
|
var length = get(this, 'length') ;
|
8713
|
-
if (
|
8714
|
-
if (
|
9040
|
+
if (isNone(beginIndex)) beginIndex = 0 ;
|
9041
|
+
if (isNone(endIndex) || (endIndex > length)) endIndex = length ;
|
8715
9042
|
|
8716
9043
|
if (beginIndex < 0) beginIndex = length + beginIndex;
|
8717
9044
|
if (endIndex < 0) endIndex = length + endIndex;
|
@@ -8871,7 +9198,7 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
|
|
8871
9198
|
@param {Number} startIdx The starting index in the array that will change.
|
8872
9199
|
@param {Number} removeAmt The number of items that will be removed. If you
|
8873
9200
|
pass `null` assumes 0
|
8874
|
-
@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
|
8875
9202
|
pass `null` assumes 0.
|
8876
9203
|
@return {Ember.Array} receiver
|
8877
9204
|
*/
|
@@ -8905,6 +9232,20 @@ Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.protot
|
|
8905
9232
|
return this;
|
8906
9233
|
},
|
8907
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
|
+
*/
|
8908
9249
|
arrayContentDidChange: function(startIdx, removeAmt, addAmt) {
|
8909
9250
|
|
8910
9251
|
// if no args are passed assume everything changes
|
@@ -9205,7 +9546,7 @@ var forEach = Ember.EnumerableUtils.forEach;
|
|
9205
9546
|
|
9206
9547
|
To add an object to an enumerable, use the `addObject()` method. This
|
9207
9548
|
method will only add the object to the enumerable if the object is not
|
9208
|
-
already present and
|
9549
|
+
already present and is of a type supported by the enumerable.
|
9209
9550
|
|
9210
9551
|
```javascript
|
9211
9552
|
set.addObject(contact);
|
@@ -9213,8 +9554,8 @@ var forEach = Ember.EnumerableUtils.forEach;
|
|
9213
9554
|
|
9214
9555
|
## Removing Objects
|
9215
9556
|
|
9216
|
-
To remove an object
|
9217
|
-
will only remove the object if it is
|
9557
|
+
To remove an object from an enumerable, use the `removeObject()` method. This
|
9558
|
+
will only remove the object if it is present in the enumerable, otherwise
|
9218
9559
|
this method has no effect.
|
9219
9560
|
|
9220
9561
|
```javascript
|
@@ -9241,7 +9582,7 @@ Ember.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable, {
|
|
9241
9582
|
already present in the collection. If the object is present, this method
|
9242
9583
|
has no effect.
|
9243
9584
|
|
9244
|
-
If the passed object is of a type not supported by the receiver
|
9585
|
+
If the passed object is of a type not supported by the receiver,
|
9245
9586
|
then this method should raise an exception.
|
9246
9587
|
|
9247
9588
|
@method addObject
|
@@ -9268,10 +9609,10 @@ Ember.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable, {
|
|
9268
9609
|
__Required.__ You must implement this method to apply this mixin.
|
9269
9610
|
|
9270
9611
|
Attempts to remove the passed object from the receiver collection if the
|
9271
|
-
object is
|
9612
|
+
object is present in the collection. If the object is not present,
|
9272
9613
|
this method has no effect.
|
9273
9614
|
|
9274
|
-
If the passed object is of a type not supported by the receiver
|
9615
|
+
If the passed object is of a type not supported by the receiver,
|
9275
9616
|
then this method should raise an exception.
|
9276
9617
|
|
9277
9618
|
@method removeObject
|
@@ -9282,7 +9623,7 @@ Ember.MutableEnumerable = Ember.Mixin.create(Ember.Enumerable, {
|
|
9282
9623
|
|
9283
9624
|
|
9284
9625
|
/**
|
9285
|
-
Removes each
|
9626
|
+
Removes each object in the passed enumerable from the receiver.
|
9286
9627
|
|
9287
9628
|
@method removeObjects
|
9288
9629
|
@param {Ember.Enumerable} objects the objects to remove
|
@@ -10063,7 +10404,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
|
|
10063
10404
|
@return {Object} The new property value
|
10064
10405
|
*/
|
10065
10406
|
incrementProperty: function(keyName, increment) {
|
10066
|
-
if (
|
10407
|
+
if (Ember.isNone(increment)) { increment = 1; }
|
10067
10408
|
set(this, keyName, (get(this, keyName) || 0)+increment);
|
10068
10409
|
return get(this, keyName);
|
10069
10410
|
},
|
@@ -10082,7 +10423,7 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
|
|
10082
10423
|
@return {Object} The new property value
|
10083
10424
|
*/
|
10084
10425
|
decrementProperty: function(keyName, increment) {
|
10085
|
-
if (
|
10426
|
+
if (Ember.isNone(increment)) { increment = 1; }
|
10086
10427
|
set(this, keyName, (get(this, keyName) || 0)-increment);
|
10087
10428
|
return get(this, keyName);
|
10088
10429
|
},
|
@@ -10138,6 +10479,15 @@ Ember.Observable = Ember.Mixin.create(/** @scope Ember.Observable.prototype */ {
|
|
10138
10479
|
var get = Ember.get, set = Ember.set;
|
10139
10480
|
|
10140
10481
|
/**
|
10482
|
+
`Ember.TargetActionSupport` is a mixin that can be included in a class
|
10483
|
+
to add a `triggerAction` method with semantics similar to the Handlebars
|
10484
|
+
`{{action}}` helper. In normal Ember usage, the `{{action}}` helper is
|
10485
|
+
usually the best choice. This mixin is most often useful when you are
|
10486
|
+
doing more complex event handling in View objects.
|
10487
|
+
|
10488
|
+
See also `Ember.ViewTargetActionSupport`, which has
|
10489
|
+
view-aware defaults for target and actionContext.
|
10490
|
+
|
10141
10491
|
@class TargetActionSupport
|
10142
10492
|
@namespace Ember
|
10143
10493
|
@extends Ember.Mixin
|
@@ -10145,6 +10495,7 @@ var get = Ember.get, set = Ember.set;
|
|
10145
10495
|
Ember.TargetActionSupport = Ember.Mixin.create({
|
10146
10496
|
target: null,
|
10147
10497
|
action: null,
|
10498
|
+
actionContext: null,
|
10148
10499
|
|
10149
10500
|
targetObject: Ember.computed(function() {
|
10150
10501
|
var target = get(this, 'target');
|
@@ -10158,21 +10509,86 @@ Ember.TargetActionSupport = Ember.Mixin.create({
|
|
10158
10509
|
}
|
10159
10510
|
}).property('target'),
|
10160
10511
|
|
10161
|
-
|
10162
|
-
var
|
10163
|
-
|
10512
|
+
actionContextObject: Ember.computed(function() {
|
10513
|
+
var actionContext = get(this, 'actionContext');
|
10514
|
+
|
10515
|
+
if (Ember.typeOf(actionContext) === "string") {
|
10516
|
+
var value = get(this, actionContext);
|
10517
|
+
if (value === undefined) { value = get(Ember.lookup, actionContext); }
|
10518
|
+
return value;
|
10519
|
+
} else {
|
10520
|
+
return actionContext;
|
10521
|
+
}
|
10522
|
+
}).property('actionContext'),
|
10523
|
+
|
10524
|
+
/**
|
10525
|
+
Send an "action" with an "actionContext" to a "target". The action, actionContext
|
10526
|
+
and target will be retrieved from properties of the object. For example:
|
10527
|
+
|
10528
|
+
```javascript
|
10529
|
+
App.SaveButtonView = Ember.View.extend(Ember.TargetActionSupport, {
|
10530
|
+
target: Ember.computed.alias('controller'),
|
10531
|
+
action: 'save',
|
10532
|
+
actionContext: Ember.computed.alias('context'),
|
10533
|
+
click: function(){
|
10534
|
+
this.triggerAction(); // Sends the `save` action, along with the current context
|
10535
|
+
// to the current controller
|
10536
|
+
}
|
10537
|
+
});
|
10538
|
+
```
|
10539
|
+
|
10540
|
+
The `target`, `action`, and `actionContext` can be provided as properties of
|
10541
|
+
an optional object argument to `triggerAction` as well.
|
10542
|
+
|
10543
|
+
```javascript
|
10544
|
+
App.SaveButtonView = Ember.View.extend(Ember.TargetActionSupport, {
|
10545
|
+
click: function(){
|
10546
|
+
this.triggerAction({
|
10547
|
+
action: 'save',
|
10548
|
+
target: this.get('controller'),
|
10549
|
+
actionContext: this.get('context'),
|
10550
|
+
}); // Sends the `save` action, along with the current context
|
10551
|
+
// to the current controller
|
10552
|
+
}
|
10553
|
+
});
|
10554
|
+
```
|
10555
|
+
|
10556
|
+
The `actionContext` defaults to the object you mixing `TargetActionSupport` into.
|
10557
|
+
But `target` and `action` must be specified either as properties or with the argument
|
10558
|
+
to `triggerAction`, or a combination:
|
10559
|
+
|
10560
|
+
```javascript
|
10561
|
+
App.SaveButtonView = Ember.View.extend(Ember.TargetActionSupport, {
|
10562
|
+
target: Ember.computed.alias('controller'),
|
10563
|
+
click: function(){
|
10564
|
+
this.triggerAction({
|
10565
|
+
action: 'save'
|
10566
|
+
}); // Sends the `save` action, along with a reference to `this`,
|
10567
|
+
// to the current controller
|
10568
|
+
}
|
10569
|
+
});
|
10570
|
+
```
|
10571
|
+
|
10572
|
+
@method triggerAction
|
10573
|
+
@param opts {Hash} (optional, with the optional keys action, target and/or actionContext)
|
10574
|
+
@return {Boolean} true if the action was sent successfully and did not return false
|
10575
|
+
*/
|
10576
|
+
triggerAction: function(opts) {
|
10577
|
+
opts = opts || {};
|
10578
|
+
var action = opts['action'] || get(this, 'action'),
|
10579
|
+
target = opts['target'] || get(this, 'targetObject'),
|
10580
|
+
actionContext = opts['actionContext'] || get(this, 'actionContextObject') || this;
|
10164
10581
|
|
10165
10582
|
if (target && action) {
|
10166
10583
|
var ret;
|
10167
10584
|
|
10168
|
-
if (
|
10169
|
-
ret = target.send(action,
|
10585
|
+
if (target.send) {
|
10586
|
+
ret = target.send.apply(target, [action, actionContext]);
|
10170
10587
|
} else {
|
10171
|
-
|
10172
|
-
|
10173
|
-
}
|
10174
|
-
ret = action.call(target, this);
|
10588
|
+
Ember.assert("The action '" + action + "' did not exist on " + target, typeof target[action] === 'function');
|
10589
|
+
ret = target[action].apply(target, [actionContext]);
|
10175
10590
|
}
|
10591
|
+
|
10176
10592
|
if (ret !== false) ret = true;
|
10177
10593
|
|
10178
10594
|
return ret;
|
@@ -10344,9 +10760,9 @@ Ember.Evented = Ember.Mixin.create({
|
|
10344
10760
|
(function() {
|
10345
10761
|
var RSVP = requireModule("rsvp");
|
10346
10762
|
|
10347
|
-
RSVP.async
|
10763
|
+
RSVP.configure('async', function(callback, binding) {
|
10348
10764
|
Ember.run.schedule('actions', binding, callback);
|
10349
|
-
};
|
10765
|
+
});
|
10350
10766
|
|
10351
10767
|
/**
|
10352
10768
|
@module ember
|
@@ -10368,9 +10784,22 @@ Ember.DeferredMixin = Ember.Mixin.create({
|
|
10368
10784
|
@param {Function} doneCallback a callback function to be called when done
|
10369
10785
|
@param {Function} failCallback a callback function to be called when failed
|
10370
10786
|
*/
|
10371
|
-
then: function(
|
10372
|
-
var promise
|
10373
|
-
|
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
|
+
});
|
10374
10803
|
},
|
10375
10804
|
|
10376
10805
|
/**
|
@@ -10379,7 +10808,16 @@ Ember.DeferredMixin = Ember.Mixin.create({
|
|
10379
10808
|
@method resolve
|
10380
10809
|
*/
|
10381
10810
|
resolve: function(value) {
|
10382
|
-
|
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
|
+
}
|
10383
10821
|
},
|
10384
10822
|
|
10385
10823
|
/**
|
@@ -10388,11 +10826,11 @@ Ember.DeferredMixin = Ember.Mixin.create({
|
|
10388
10826
|
@method reject
|
10389
10827
|
*/
|
10390
10828
|
reject: function(value) {
|
10391
|
-
get(this, '
|
10829
|
+
get(this, '_deferred').reject(value);
|
10392
10830
|
},
|
10393
10831
|
|
10394
|
-
|
10395
|
-
return new RSVP.
|
10832
|
+
_deferred: Ember.computed(function() {
|
10833
|
+
return new RSVP.defer();
|
10396
10834
|
})
|
10397
10835
|
});
|
10398
10836
|
|
@@ -11081,7 +11519,7 @@ function findNamespaces() {
|
|
11081
11519
|
|
11082
11520
|
for (var prop in lookup) {
|
11083
11521
|
// These don't raise exceptions but can cause warnings
|
11084
|
-
if (prop === "parent" || prop === "top" || prop === "frameElement") { continue; }
|
11522
|
+
if (prop === "parent" || prop === "top" || prop === "frameElement" || prop === "webkitStorageInfo") { continue; }
|
11085
11523
|
|
11086
11524
|
// get(window.globalStorage, 'isNamespace') would try to read the storage for domain isNamespace and cause exception in Firefox.
|
11087
11525
|
// globalStorage is a storage obsoleted by the WhatWG storage specification. See https://developer.mozilla.org/en/DOM/Storage#globalStorage
|
@@ -11993,9 +12431,8 @@ if (ignore.length>0) {
|
|
11993
12431
|
@namespace Ember
|
11994
12432
|
@extends Ember.Mixin
|
11995
12433
|
@uses Ember.MutableArray
|
11996
|
-
@uses Ember.
|
12434
|
+
@uses Ember.Observable
|
11997
12435
|
@uses Ember.Copyable
|
11998
|
-
@uses Ember.Freezable
|
11999
12436
|
*/
|
12000
12437
|
Ember.NativeArray = NativeArray;
|
12001
12438
|
|
@@ -12042,7 +12479,7 @@ if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Array) {
|
|
12042
12479
|
@submodule ember-runtime
|
12043
12480
|
*/
|
12044
12481
|
|
12045
|
-
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;
|
12046
12483
|
|
12047
12484
|
/**
|
12048
12485
|
An unordered collection of objects.
|
@@ -12400,7 +12837,7 @@ Ember.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Emb
|
|
12400
12837
|
// implements Ember.MutableEnumerable
|
12401
12838
|
addObject: function(obj) {
|
12402
12839
|
if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);
|
12403
|
-
if (
|
12840
|
+
if (isNone(obj)) return this; // nothing to do
|
12404
12841
|
|
12405
12842
|
var guid = guidFor(obj),
|
12406
12843
|
idx = this[guid],
|
@@ -12428,7 +12865,7 @@ Ember.Set = Ember.CoreObject.extend(Ember.MutableEnumerable, Ember.Copyable, Emb
|
|
12428
12865
|
// implements Ember.MutableEnumerable
|
12429
12866
|
removeObject: function(obj) {
|
12430
12867
|
if (get(this, 'isFrozen')) throw new Error(Ember.FROZEN_ERROR);
|
12431
|
-
if (
|
12868
|
+
if (isNone(obj)) return this; // nothing to do
|
12432
12869
|
|
12433
12870
|
var guid = guidFor(obj),
|
12434
12871
|
idx = this[guid],
|
@@ -12503,7 +12940,7 @@ Deferred.reopenClass({
|
|
12503
12940
|
promise: function(callback, binding) {
|
12504
12941
|
var deferred = Deferred.create();
|
12505
12942
|
callback.call(binding, deferred);
|
12506
|
-
return
|
12943
|
+
return deferred;
|
12507
12944
|
}
|
12508
12945
|
});
|
12509
12946
|
|
@@ -12514,6 +12951,8 @@ Ember.Deferred = Deferred;
|
|
12514
12951
|
|
12515
12952
|
|
12516
12953
|
(function() {
|
12954
|
+
var forEach = Ember.ArrayPolyfills.forEach;
|
12955
|
+
|
12517
12956
|
/**
|
12518
12957
|
@module ember
|
12519
12958
|
@submodule ember-runtime
|
@@ -12546,12 +12985,10 @@ Ember.onLoad = function(name, callback) {
|
|
12546
12985
|
@param object {Object} object to pass to callbacks
|
12547
12986
|
*/
|
12548
12987
|
Ember.runLoadHooks = function(name, object) {
|
12549
|
-
var hooks;
|
12550
|
-
|
12551
12988
|
loaded[name] = object;
|
12552
12989
|
|
12553
|
-
if (
|
12554
|
-
loadHooks[name]
|
12990
|
+
if (loadHooks[name]) {
|
12991
|
+
forEach.call(loadHooks[name], function(callback) {
|
12555
12992
|
callback(object);
|
12556
12993
|
});
|
12557
12994
|
}
|
@@ -13006,9 +13443,9 @@ Ember.ArrayController = Ember.ArrayProxy.extend(Ember.ControllerMixin,
|
|
13006
13443
|
});
|
13007
13444
|
```
|
13008
13445
|
|
13009
|
-
@method
|
13010
|
-
@
|
13011
|
-
@
|
13446
|
+
@method lookupItemController
|
13447
|
+
@param {Object} object
|
13448
|
+
@return {String}
|
13012
13449
|
*/
|
13013
13450
|
lookupItemController: function(object) {
|
13014
13451
|
return get(this, 'itemController');
|
@@ -13086,10 +13523,11 @@ Ember.ArrayController = Ember.ArrayProxy.extend(Ember.ControllerMixin,
|
|
13086
13523
|
|
13087
13524
|
_resetSubControllers: function() {
|
13088
13525
|
var subControllers = get(this, '_subControllers');
|
13089
|
-
|
13090
|
-
|
13091
|
-
|
13092
|
-
|
13526
|
+
if (subControllers) {
|
13527
|
+
forEach(subControllers, function(subController) {
|
13528
|
+
if (subController) { subController.destroy(); }
|
13529
|
+
});
|
13530
|
+
}
|
13093
13531
|
|
13094
13532
|
this.set('_subControllers', Ember.A());
|
13095
13533
|
}
|
@@ -13782,8 +14220,11 @@ Ember._RenderBuffer.prototype =
|
|
13782
14220
|
string: function() {
|
13783
14221
|
if (this._hasElement && this._element) {
|
13784
14222
|
// Firefox versions < 11 do not have support for element.outerHTML.
|
13785
|
-
|
13786
|
-
|
14223
|
+
var thisElement = this.element(), outerHTML = thisElement.outerHTML;
|
14224
|
+
if (typeof outerHTML === 'undefined'){
|
14225
|
+
return Ember.$('<div/>').append(thisElement).html();
|
14226
|
+
}
|
14227
|
+
return outerHTML;
|
13787
14228
|
} else {
|
13788
14229
|
return this.innerString();
|
13789
14230
|
}
|
@@ -13875,7 +14316,7 @@ Ember.EventDispatcher = Ember.Object.extend(
|
|
13875
14316
|
@method setup
|
13876
14317
|
@param addedEvents {Hash}
|
13877
14318
|
*/
|
13878
|
-
setup: function(addedEvents) {
|
14319
|
+
setup: function(addedEvents, rootElement) {
|
13879
14320
|
var event, events = {
|
13880
14321
|
touchstart : 'touchStart',
|
13881
14322
|
touchmove : 'touchMove',
|
@@ -13908,7 +14349,12 @@ Ember.EventDispatcher = Ember.Object.extend(
|
|
13908
14349
|
|
13909
14350
|
Ember.$.extend(events, addedEvents || {});
|
13910
14351
|
|
13911
|
-
|
14352
|
+
|
14353
|
+
if (!Ember.isNone(rootElement)) {
|
14354
|
+
set(this, 'rootElement', rootElement);
|
14355
|
+
}
|
14356
|
+
|
14357
|
+
rootElement = Ember.$(get(this, 'rootElement'));
|
13912
14358
|
|
13913
14359
|
Ember.assert(fmt('You cannot use the same root element (%@) multiple times in an Ember.Application', [rootElement.selector || rootElement[0].tagName]), !rootElement.is('.ember-application'));
|
13914
14360
|
Ember.assert('You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application', !rootElement.closest('.ember-application').length);
|
@@ -14226,7 +14672,7 @@ Ember.CoreView = Ember.Object.extend(Ember.Evented, {
|
|
14226
14672
|
// insert a new buffer after the "parent buffer").
|
14227
14673
|
var tagName = this.tagName;
|
14228
14674
|
|
14229
|
-
if (tagName
|
14675
|
+
if (Ember.isNone(tagName)) {
|
14230
14676
|
tagName = 'div';
|
14231
14677
|
}
|
14232
14678
|
|
@@ -14314,6 +14760,15 @@ ViewCollection.prototype = {
|
|
14314
14760
|
}
|
14315
14761
|
},
|
14316
14762
|
|
14763
|
+
invokeRecursively: function(fn) {
|
14764
|
+
var views = this.views, view;
|
14765
|
+
|
14766
|
+
for (var i = 0, l = views.length; i < l; i++) {
|
14767
|
+
view = views[i];
|
14768
|
+
fn(view);
|
14769
|
+
}
|
14770
|
+
},
|
14771
|
+
|
14317
14772
|
transitionTo: function(state, children) {
|
14318
14773
|
var views = this.views;
|
14319
14774
|
for (var i = 0, l = views.length; i < l; i++) {
|
@@ -14331,9 +14786,9 @@ ViewCollection.prototype = {
|
|
14331
14786
|
return this.views[idx];
|
14332
14787
|
},
|
14333
14788
|
|
14334
|
-
forEach: function() {
|
14789
|
+
forEach: function(callback) {
|
14335
14790
|
var views = this.views;
|
14336
|
-
return
|
14791
|
+
return a_forEach(views, callback);
|
14337
14792
|
},
|
14338
14793
|
|
14339
14794
|
clear: function() {
|
@@ -15399,7 +15854,7 @@ Ember.View = Ember.CoreView.extend(
|
|
15399
15854
|
@param {Ember.RenderBuffer} buffer
|
15400
15855
|
*/
|
15401
15856
|
_applyAttributeBindings: function(buffer, attributeBindings) {
|
15402
|
-
var attributeValue, elem
|
15857
|
+
var attributeValue, elem;
|
15403
15858
|
|
15404
15859
|
a_forEach(attributeBindings, function(binding) {
|
15405
15860
|
var split = binding.split(':'),
|
@@ -15490,7 +15945,7 @@ Ember.View = Ember.CoreView.extend(
|
|
15490
15945
|
|
15491
15946
|
while(--idx >= 0) {
|
15492
15947
|
view = childViews[idx];
|
15493
|
-
callback
|
15948
|
+
callback(this, view, idx);
|
15494
15949
|
}
|
15495
15950
|
|
15496
15951
|
return this;
|
@@ -15504,9 +15959,9 @@ Ember.View = Ember.CoreView.extend(
|
|
15504
15959
|
var len = childViews.length,
|
15505
15960
|
view, idx;
|
15506
15961
|
|
15507
|
-
for(idx = 0; idx < len; idx++) {
|
15962
|
+
for (idx = 0; idx < len; idx++) {
|
15508
15963
|
view = childViews[idx];
|
15509
|
-
callback
|
15964
|
+
callback(view);
|
15510
15965
|
}
|
15511
15966
|
|
15512
15967
|
return this;
|
@@ -15718,7 +16173,7 @@ Ember.View = Ember.CoreView.extend(
|
|
15718
16173
|
|
15719
16174
|
for (var i=0, l=currentViews.length; i<l; i++) {
|
15720
16175
|
view = currentViews[i];
|
15721
|
-
fn
|
16176
|
+
fn(view);
|
15722
16177
|
if (view._childViews) {
|
15723
16178
|
childViews.push.apply(childViews, view._childViews);
|
15724
16179
|
}
|
@@ -16082,13 +16537,13 @@ Ember.View = Ember.CoreView.extend(
|
|
16082
16537
|
@return {Ember.View} receiver
|
16083
16538
|
*/
|
16084
16539
|
removeAllChildren: function() {
|
16085
|
-
return this.mutateChildViews(function(view) {
|
16086
|
-
|
16540
|
+
return this.mutateChildViews(function(parentView, view) {
|
16541
|
+
parentView.removeChild(view);
|
16087
16542
|
});
|
16088
16543
|
},
|
16089
16544
|
|
16090
16545
|
destroyAllChildren: function() {
|
16091
|
-
return this.mutateChildViews(function(view) {
|
16546
|
+
return this.mutateChildViews(function(parentView, view) {
|
16092
16547
|
view.destroy();
|
16093
16548
|
});
|
16094
16549
|
},
|
@@ -16120,7 +16575,6 @@ Ember.View = Ember.CoreView.extend(
|
|
16120
16575
|
*/
|
16121
16576
|
destroy: function() {
|
16122
16577
|
var childViews = this._childViews,
|
16123
|
-
parent = this._parentView,
|
16124
16578
|
// get parentView before calling super because it'll be destroyed
|
16125
16579
|
nonVirtualParentView = get(this, 'parentView'),
|
16126
16580
|
viewName = this.viewName,
|
@@ -16135,7 +16589,7 @@ Ember.View = Ember.CoreView.extend(
|
|
16135
16589
|
|
16136
16590
|
// remove from non-virtual parent view if viewName was specified
|
16137
16591
|
if (viewName && nonVirtualParentView) {
|
16138
|
-
nonVirtualParentView
|
16592
|
+
nonVirtualParentView.set(viewName, null);
|
16139
16593
|
}
|
16140
16594
|
|
16141
16595
|
childLen = childViews.length;
|
@@ -17168,7 +17622,7 @@ Ember.ContainerView = Ember.View.extend(Ember.MutableArray, {
|
|
17168
17622
|
});
|
17169
17623
|
},
|
17170
17624
|
|
17171
|
-
instrumentName: '
|
17625
|
+
instrumentName: 'container',
|
17172
17626
|
|
17173
17627
|
/**
|
17174
17628
|
@private
|
@@ -17283,21 +17737,6 @@ Ember.merge(states.hasElement, {
|
|
17283
17737
|
ensureChildrenAreInDOM: function(view) {
|
17284
17738
|
var childViews = view._childViews, i, len, childView, previous, buffer, viewCollection = new ViewCollection();
|
17285
17739
|
|
17286
|
-
function insertViewCollection() {
|
17287
|
-
viewCollection.triggerRecursively('willInsertElement');
|
17288
|
-
if (previous) {
|
17289
|
-
previous.domManager.after(previous, buffer.string());
|
17290
|
-
} else {
|
17291
|
-
view.domManager.prepend(view, buffer.string());
|
17292
|
-
}
|
17293
|
-
buffer = null;
|
17294
|
-
viewCollection.forEach(function(v) {
|
17295
|
-
v.transitionTo('inDOM');
|
17296
|
-
v.propertyDidChange('element');
|
17297
|
-
v.triggerRecursively('didInsertElement');
|
17298
|
-
});
|
17299
|
-
}
|
17300
|
-
|
17301
17740
|
for (i = 0, len = childViews.length; i < len; i++) {
|
17302
17741
|
childView = childViews[i];
|
17303
17742
|
|
@@ -17306,7 +17745,8 @@ Ember.merge(states.hasElement, {
|
|
17306
17745
|
if (childView.renderToBufferIfNeeded(buffer)) {
|
17307
17746
|
viewCollection.push(childView);
|
17308
17747
|
} else if (viewCollection.length) {
|
17309
|
-
insertViewCollection();
|
17748
|
+
insertViewCollection(view, viewCollection, previous, buffer);
|
17749
|
+
buffer = null;
|
17310
17750
|
previous = childView;
|
17311
17751
|
viewCollection.clear();
|
17312
17752
|
} else {
|
@@ -17314,10 +17754,29 @@ Ember.merge(states.hasElement, {
|
|
17314
17754
|
}
|
17315
17755
|
}
|
17316
17756
|
|
17317
|
-
if (viewCollection.length) {
|
17757
|
+
if (viewCollection.length) {
|
17758
|
+
insertViewCollection(view, viewCollection, previous, buffer);
|
17759
|
+
}
|
17318
17760
|
}
|
17319
17761
|
});
|
17320
17762
|
|
17763
|
+
function insertViewCollection(view, viewCollection, previous, buffer) {
|
17764
|
+
viewCollection.triggerRecursively('willInsertElement');
|
17765
|
+
|
17766
|
+
if (previous) {
|
17767
|
+
previous.domManager.after(previous, buffer.string());
|
17768
|
+
} else {
|
17769
|
+
view.domManager.prepend(view, buffer.string());
|
17770
|
+
}
|
17771
|
+
|
17772
|
+
viewCollection.forEach(function(v) {
|
17773
|
+
v.transitionTo('inDOM');
|
17774
|
+
v.propertyDidChange('element');
|
17775
|
+
v.triggerRecursively('didInsertElement');
|
17776
|
+
});
|
17777
|
+
}
|
17778
|
+
|
17779
|
+
|
17321
17780
|
})();
|
17322
17781
|
|
17323
17782
|
|
@@ -17694,6 +18153,69 @@ Ember.CollectionView.CONTAINER_MAP = {
|
|
17694
18153
|
|
17695
18154
|
|
17696
18155
|
|
18156
|
+
(function() {
|
18157
|
+
/**
|
18158
|
+
`Ember.ViewTargetActionSupport` is a mixin that can be included in a
|
18159
|
+
view class to add a `triggerAction` method with semantics similar to
|
18160
|
+
the Handlebars `{{action}}` helper. It provides intelligent defaults
|
18161
|
+
for the action's target: the view's controller; and the context that is
|
18162
|
+
sent with the action: the view's context.
|
18163
|
+
|
18164
|
+
Note: In normal Ember usage, the `{{action}}` helper is usually the best
|
18165
|
+
choice. This mixin is most often useful when you are doing more complex
|
18166
|
+
event handling in custom View subclasses.
|
18167
|
+
|
18168
|
+
For example:
|
18169
|
+
|
18170
|
+
```javascript
|
18171
|
+
App.SaveButtonView = Ember.View.extend(Ember.ViewTargetActionSupport, {
|
18172
|
+
action: 'save',
|
18173
|
+
click: function(){
|
18174
|
+
this.triggerAction(); // Sends the `save` action, along with the current context
|
18175
|
+
// to the current controller
|
18176
|
+
}
|
18177
|
+
});
|
18178
|
+
```
|
18179
|
+
|
18180
|
+
The `action` can be provided as properties of an optional object argument
|
18181
|
+
to `triggerAction` as well.
|
18182
|
+
|
18183
|
+
```javascript
|
18184
|
+
App.SaveButtonView = Ember.View.extend(Ember.ViewTargetActionSupport, {
|
18185
|
+
click: function(){
|
18186
|
+
this.triggerAction({
|
18187
|
+
action: 'save'
|
18188
|
+
}); // Sends the `save` action, along with the current context
|
18189
|
+
// to the current controller
|
18190
|
+
}
|
18191
|
+
});
|
18192
|
+
```
|
18193
|
+
|
18194
|
+
@class ViewTargetActionSupport
|
18195
|
+
@namespace Ember
|
18196
|
+
@extends Ember.TargetActionSupport
|
18197
|
+
*/
|
18198
|
+
Ember.ViewTargetActionSupport = Ember.Mixin.create(Ember.TargetActionSupport, {
|
18199
|
+
/**
|
18200
|
+
@property target
|
18201
|
+
*/
|
18202
|
+
target: Ember.computed.alias('controller'),
|
18203
|
+
/**
|
18204
|
+
@property actionContext
|
18205
|
+
*/
|
18206
|
+
actionContext: Ember.computed.alias('context')
|
18207
|
+
});
|
18208
|
+
|
18209
|
+
})();
|
18210
|
+
|
18211
|
+
|
18212
|
+
|
18213
|
+
(function() {
|
18214
|
+
|
18215
|
+
})();
|
18216
|
+
|
18217
|
+
|
18218
|
+
|
17697
18219
|
(function() {
|
17698
18220
|
/*globals jQuery*/
|
17699
18221
|
/**
|
@@ -17810,8 +18332,26 @@ Ember.State = Ember.Object.extend(Ember.Evented,
|
|
17810
18332
|
}
|
17811
18333
|
}
|
17812
18334
|
|
17813
|
-
|
17814
|
-
|
18335
|
+
// pathsCaches is a nested hash of the form:
|
18336
|
+
// pathsCaches[stateManagerTypeGuid][path] == transitions_hash
|
18337
|
+
set(this, 'pathsCaches', {});
|
18338
|
+
},
|
18339
|
+
|
18340
|
+
setPathsCache: function(stateManager, path, transitions) {
|
18341
|
+
var stateManagerTypeGuid = Ember.guidFor(stateManager.constructor),
|
18342
|
+
pathsCaches = get(this, 'pathsCaches'),
|
18343
|
+
pathsCacheForManager = pathsCaches[stateManagerTypeGuid] || {};
|
18344
|
+
|
18345
|
+
pathsCacheForManager[path] = transitions;
|
18346
|
+
pathsCaches[stateManagerTypeGuid] = pathsCacheForManager;
|
18347
|
+
},
|
18348
|
+
|
18349
|
+
getPathsCache: function(stateManager, path) {
|
18350
|
+
var stateManagerTypeGuid = Ember.guidFor(stateManager.constructor),
|
18351
|
+
pathsCaches = get(this, 'pathsCaches'),
|
18352
|
+
pathsCacheForManager = pathsCaches[stateManagerTypeGuid] || {};
|
18353
|
+
|
18354
|
+
return pathsCacheForManager[path];
|
17815
18355
|
},
|
17816
18356
|
|
17817
18357
|
setupChild: function(states, name, value) {
|
@@ -18799,7 +19339,7 @@ Ember.StateManager = Ember.State.extend({
|
|
18799
19339
|
},
|
18800
19340
|
|
18801
19341
|
contextFreeTransition: function(currentState, path) {
|
18802
|
-
var cache = currentState.
|
19342
|
+
var cache = currentState.getPathsCache(this, path);
|
18803
19343
|
if (cache) { return cache; }
|
18804
19344
|
|
18805
19345
|
var enterStates = this.getStatesInPath(currentState, path),
|
@@ -18885,12 +19425,14 @@ Ember.StateManager = Ember.State.extend({
|
|
18885
19425
|
|
18886
19426
|
// Cache the enterStates, exitStates, and resolveState for the
|
18887
19427
|
// current state and the `path`.
|
18888
|
-
var transitions =
|
19428
|
+
var transitions = {
|
18889
19429
|
exitStates: exitStates,
|
18890
19430
|
enterStates: enterStates,
|
18891
19431
|
resolveState: resolveState
|
18892
19432
|
};
|
18893
19433
|
|
19434
|
+
currentState.setPathsCache(this, path, transitions);
|
19435
|
+
|
18894
19436
|
return transitions;
|
18895
19437
|
},
|
18896
19438
|
|
@@ -19448,10 +19990,25 @@ Ember.assert("Ember Handlebars requires Handlebars 1.0.0-rc.3 or greater. Includ
|
|
19448
19990
|
*/
|
19449
19991
|
Ember.Handlebars = objectCreate(Handlebars);
|
19450
19992
|
|
19993
|
+
function makeBindings(options) {
|
19994
|
+
var hash = options.hash,
|
19995
|
+
hashType = options.hashTypes;
|
19996
|
+
|
19997
|
+
for (var prop in hash) {
|
19998
|
+
if (hashType[prop] === 'ID') {
|
19999
|
+
hash[prop + 'Binding'] = hash[prop];
|
20000
|
+
hashType[prop + 'Binding'] = 'STRING';
|
20001
|
+
delete hash[prop];
|
20002
|
+
delete hashType[prop];
|
20003
|
+
}
|
20004
|
+
}
|
20005
|
+
}
|
20006
|
+
|
19451
20007
|
Ember.Handlebars.helper = function(name, value) {
|
19452
20008
|
if (Ember.View.detect(value)) {
|
19453
|
-
Ember.Handlebars.registerHelper(name, function(
|
20009
|
+
Ember.Handlebars.registerHelper(name, function(options) {
|
19454
20010
|
Ember.assert("You can only pass attributes as parameters to a application-defined helper", arguments.length < 3);
|
20011
|
+
makeBindings(options);
|
19455
20012
|
return Ember.Handlebars.helpers.view.call(this, value, options);
|
19456
20013
|
});
|
19457
20014
|
} else {
|
@@ -19928,6 +20485,7 @@ Ember.Handlebars.registerBoundHelper = function(name, fn) {
|
|
19928
20485
|
|
19929
20486
|
Renders the unbound form of an otherwise bound helper function.
|
19930
20487
|
|
20488
|
+
@method evaluateMultiPropertyBoundHelper
|
19931
20489
|
@param {Function} fn
|
19932
20490
|
@param {Object} context
|
19933
20491
|
@param {Array} normalizedProperties
|
@@ -19944,7 +20502,7 @@ function evaluateMultiPropertyBoundHelper(context, fn, normalizedProperties, opt
|
|
19944
20502
|
|
19945
20503
|
bindView = new Ember._SimpleHandlebarsView(null, null, !hash.unescaped, data);
|
19946
20504
|
bindView.normalizedValue = function() {
|
19947
|
-
var args = [],
|
20505
|
+
var args = [], boundOption;
|
19948
20506
|
|
19949
20507
|
// Copy over bound options.
|
19950
20508
|
for (boundOption in boundOptions) {
|
@@ -19989,6 +20547,7 @@ function evaluateMultiPropertyBoundHelper(context, fn, normalizedProperties, opt
|
|
19989
20547
|
|
19990
20548
|
Renders the unbound form of an otherwise bound helper function.
|
19991
20549
|
|
20550
|
+
@method evaluateUnboundHelper
|
19992
20551
|
@param {Function} fn
|
19993
20552
|
@param {Object} context
|
19994
20553
|
@param {Array} normalizedProperties
|
@@ -20127,13 +20686,18 @@ var DOMManager = {
|
|
20127
20686
|
var buffer = view.renderToBuffer();
|
20128
20687
|
|
20129
20688
|
view.invokeRecursively(function(view) {
|
20130
|
-
view.
|
20689
|
+
view.propertyWillChange('element');
|
20131
20690
|
});
|
20132
|
-
|
20133
20691
|
view.triggerRecursively('willInsertElement');
|
20692
|
+
|
20134
20693
|
morph.replaceWith(buffer.string());
|
20135
20694
|
view.transitionTo('inDOM');
|
20695
|
+
|
20696
|
+
view.invokeRecursively(function(view) {
|
20697
|
+
view.propertyDidChange('element');
|
20698
|
+
});
|
20136
20699
|
view.triggerRecursively('didInsertElement');
|
20700
|
+
|
20137
20701
|
notifyMutationListeners();
|
20138
20702
|
});
|
20139
20703
|
},
|
@@ -20157,7 +20721,7 @@ Ember._Metamorph = Ember.Mixin.create({
|
|
20157
20721
|
isVirtual: true,
|
20158
20722
|
tagName: '',
|
20159
20723
|
|
20160
|
-
instrumentName: '
|
20724
|
+
instrumentName: 'metamorph',
|
20161
20725
|
|
20162
20726
|
init: function() {
|
20163
20727
|
this._super();
|
@@ -20242,6 +20806,8 @@ SimpleHandlebarsView.prototype = {
|
|
20242
20806
|
this.morph = null;
|
20243
20807
|
},
|
20244
20808
|
|
20809
|
+
propertyWillChange: Ember.K,
|
20810
|
+
|
20245
20811
|
propertyDidChange: Ember.K,
|
20246
20812
|
|
20247
20813
|
normalizedValue: function() {
|
@@ -20344,7 +20910,7 @@ merge(states.inDOM, {
|
|
20344
20910
|
@private
|
20345
20911
|
*/
|
20346
20912
|
Ember._HandlebarsBoundView = Ember._MetamorphView.extend({
|
20347
|
-
instrumentName: '
|
20913
|
+
instrumentName: 'boundHandlebars',
|
20348
20914
|
states: states,
|
20349
20915
|
|
20350
20916
|
/**
|
@@ -20949,7 +21515,7 @@ EmberHandlebars.registerHelper('unless', function(context, options) {
|
|
20949
21515
|
Results in the following rendered output:
|
20950
21516
|
|
20951
21517
|
```html
|
20952
|
-
<img class="
|
21518
|
+
<img class="class-name-to-always-apply">
|
20953
21519
|
```
|
20954
21520
|
|
20955
21521
|
All three strategies - string return value, boolean return value, and
|
@@ -21288,11 +21854,8 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
|
|
21288
21854
|
},
|
21289
21855
|
|
21290
21856
|
helper: function(thisContext, path, options) {
|
21291
|
-
var
|
21292
|
-
data = options.data,
|
21293
|
-
view = data.view,
|
21857
|
+
var data = options.data,
|
21294
21858
|
fn = options.fn,
|
21295
|
-
hash = options.hash,
|
21296
21859
|
newView;
|
21297
21860
|
|
21298
21861
|
if ('string' === typeof path) {
|
@@ -21306,7 +21869,7 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
|
|
21306
21869
|
|
21307
21870
|
var viewOptions = this.propertiesFromHTMLOptions(options, thisContext);
|
21308
21871
|
var currentView = data.view;
|
21309
|
-
viewOptions.templateData =
|
21872
|
+
viewOptions.templateData = data;
|
21310
21873
|
var newViewProto = newView.proto ? newView.proto() : newView;
|
21311
21874
|
|
21312
21875
|
if (fn) {
|
@@ -21433,9 +21996,8 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
|
|
21433
21996
|
{{/view}}
|
21434
21997
|
```
|
21435
21998
|
|
21436
|
-
The first argument can also be a relative path
|
21437
|
-
|
21438
|
-
used as the root object:
|
21999
|
+
The first argument can also be a relative path accessible from the current
|
22000
|
+
context.
|
21439
22001
|
|
21440
22002
|
```javascript
|
21441
22003
|
MyApp = Ember.Application.create({});
|
@@ -21443,7 +22005,7 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
|
|
21443
22005
|
innerViewClass: Ember.View.extend({
|
21444
22006
|
classNames: ['a-custom-view-class-as-property']
|
21445
22007
|
}),
|
21446
|
-
template: Ember.Handlebars.compile('{{#view "innerViewClass"}} hi {{/view}}')
|
22008
|
+
template: Ember.Handlebars.compile('{{#view "view.innerViewClass"}} hi {{/view}}')
|
21447
22009
|
});
|
21448
22010
|
|
21449
22011
|
MyApp.OuterView.create().appendTo('body');
|
@@ -21688,8 +22250,6 @@ Ember.Handlebars.registerHelper('collection', function(path, options) {
|
|
21688
22250
|
}
|
21689
22251
|
}
|
21690
22252
|
|
21691
|
-
var tagName = hash.tagName || collectionPrototype.tagName;
|
21692
|
-
|
21693
22253
|
if (fn) {
|
21694
22254
|
itemHash.template = fn;
|
21695
22255
|
delete options.fn;
|
@@ -21711,8 +22271,6 @@ Ember.Handlebars.registerHelper('collection', function(path, options) {
|
|
21711
22271
|
itemHash._context = Ember.computed.alias('content');
|
21712
22272
|
}
|
21713
22273
|
|
21714
|
-
var viewString = view.toString();
|
21715
|
-
|
21716
22274
|
var viewOptions = Ember.Handlebars.ViewHelper.propertiesFromHTMLOptions({ data: data, hash: itemHash }, this);
|
21717
22275
|
hash.itemViewClass = itemViewClass.extend(viewOptions);
|
21718
22276
|
|
@@ -22864,6 +23422,55 @@ var set = Ember.set,
|
|
22864
23422
|
isArray = Ember.isArray,
|
22865
23423
|
precompileTemplate = Ember.Handlebars.compile;
|
22866
23424
|
|
23425
|
+
Ember.SelectOption = Ember.View.extend({
|
23426
|
+
tagName: 'option',
|
23427
|
+
attributeBindings: ['value', 'selected'],
|
23428
|
+
|
23429
|
+
defaultTemplate: function(context, options) {
|
23430
|
+
options = { data: options.data, hash: {} };
|
23431
|
+
Ember.Handlebars.helpers.bind.call(context, "view.label", options);
|
23432
|
+
},
|
23433
|
+
|
23434
|
+
init: function() {
|
23435
|
+
this.labelPathDidChange();
|
23436
|
+
this.valuePathDidChange();
|
23437
|
+
|
23438
|
+
this._super();
|
23439
|
+
},
|
23440
|
+
|
23441
|
+
selected: Ember.computed(function() {
|
23442
|
+
var content = get(this, 'content'),
|
23443
|
+
selection = get(this, 'parentView.selection');
|
23444
|
+
if (get(this, 'parentView.multiple')) {
|
23445
|
+
return selection && indexOf(selection, content.valueOf()) > -1;
|
23446
|
+
} else {
|
23447
|
+
// Primitives get passed through bindings as objects... since
|
23448
|
+
// `new Number(4) !== 4`, we use `==` below
|
23449
|
+
return content == selection;
|
23450
|
+
}
|
23451
|
+
}).property('content', 'parentView.selection'),
|
23452
|
+
|
23453
|
+
labelPathDidChange: Ember.observer(function() {
|
23454
|
+
var labelPath = get(this, 'parentView.optionLabelPath');
|
23455
|
+
|
23456
|
+
if (!labelPath) { return; }
|
23457
|
+
|
23458
|
+
Ember.defineProperty(this, 'label', Ember.computed(function() {
|
23459
|
+
return get(this, labelPath);
|
23460
|
+
}).property(labelPath));
|
23461
|
+
}, 'parentView.optionLabelPath'),
|
23462
|
+
|
23463
|
+
valuePathDidChange: Ember.observer(function() {
|
23464
|
+
var valuePath = get(this, 'parentView.optionValuePath');
|
23465
|
+
|
23466
|
+
if (!valuePath) { return; }
|
23467
|
+
|
23468
|
+
Ember.defineProperty(this, 'value', Ember.computed(function() {
|
23469
|
+
return get(this, valuePath);
|
23470
|
+
}).property(valuePath));
|
23471
|
+
}, 'parentView.optionValuePath')
|
23472
|
+
});
|
23473
|
+
|
22867
23474
|
/**
|
22868
23475
|
The `Ember.Select` view class renders a
|
22869
23476
|
[select](https://developer.mozilla.org/en/HTML/Element/select) HTML element,
|
@@ -23040,7 +23647,7 @@ var set = Ember.set,
|
|
23040
23647
|
Interacting with the rendered element by selecting the first option
|
23041
23648
|
('Yehuda') will update the `selectedPerson` value of `App.controller`
|
23042
23649
|
to match the content object of the newly selected `<option>`. In this
|
23043
|
-
case it is the first object in the `App.
|
23650
|
+
case it is the first object in the `App.controller.content`
|
23044
23651
|
|
23045
23652
|
### Supplying a Prompt
|
23046
23653
|
|
@@ -23135,7 +23742,7 @@ function program3(depth0,data) {
|
|
23135
23742
|
|
23136
23743
|
var hashTypes;
|
23137
23744
|
hashTypes = {'contentBinding': "STRING"};
|
23138
|
-
data.buffer.push(escapeExpression(helpers.view.call(depth0, "
|
23745
|
+
data.buffer.push(escapeExpression(helpers.view.call(depth0, "view.optionView", {hash:{
|
23139
23746
|
'contentBinding': ("this")
|
23140
23747
|
},contexts:[depth0],types:["ID"],hashTypes:hashTypes,data:data})));
|
23141
23748
|
}
|
@@ -23244,6 +23851,15 @@ function program3(depth0,data) {
|
|
23244
23851
|
*/
|
23245
23852
|
optionValuePath: 'content',
|
23246
23853
|
|
23854
|
+
/**
|
23855
|
+
The view class for option.
|
23856
|
+
|
23857
|
+
@property optionView
|
23858
|
+
@type Ember.View
|
23859
|
+
@default Ember.SelectOption
|
23860
|
+
*/
|
23861
|
+
optionView: Ember.SelectOption,
|
23862
|
+
|
23247
23863
|
_change: function() {
|
23248
23864
|
if (get(this, 'multiple')) {
|
23249
23865
|
this._changeMultiple();
|
@@ -23364,55 +23980,6 @@ function program3(depth0,data) {
|
|
23364
23980
|
}
|
23365
23981
|
});
|
23366
23982
|
|
23367
|
-
Ember.SelectOption = Ember.View.extend({
|
23368
|
-
tagName: 'option',
|
23369
|
-
attributeBindings: ['value', 'selected'],
|
23370
|
-
|
23371
|
-
defaultTemplate: function(context, options) {
|
23372
|
-
options = { data: options.data, hash: {} };
|
23373
|
-
Ember.Handlebars.helpers.bind.call(context, "view.label", options);
|
23374
|
-
},
|
23375
|
-
|
23376
|
-
init: function() {
|
23377
|
-
this.labelPathDidChange();
|
23378
|
-
this.valuePathDidChange();
|
23379
|
-
|
23380
|
-
this._super();
|
23381
|
-
},
|
23382
|
-
|
23383
|
-
selected: Ember.computed(function() {
|
23384
|
-
var content = get(this, 'content'),
|
23385
|
-
selection = get(this, 'parentView.selection');
|
23386
|
-
if (get(this, 'parentView.multiple')) {
|
23387
|
-
return selection && indexOf(selection, content.valueOf()) > -1;
|
23388
|
-
} else {
|
23389
|
-
// Primitives get passed through bindings as objects... since
|
23390
|
-
// `new Number(4) !== 4`, we use `==` below
|
23391
|
-
return content == selection;
|
23392
|
-
}
|
23393
|
-
}).property('content', 'parentView.selection'),
|
23394
|
-
|
23395
|
-
labelPathDidChange: Ember.observer(function() {
|
23396
|
-
var labelPath = get(this, 'parentView.optionLabelPath');
|
23397
|
-
|
23398
|
-
if (!labelPath) { return; }
|
23399
|
-
|
23400
|
-
Ember.defineProperty(this, 'label', Ember.computed(function() {
|
23401
|
-
return get(this, labelPath);
|
23402
|
-
}).property(labelPath));
|
23403
|
-
}, 'parentView.optionLabelPath'),
|
23404
|
-
|
23405
|
-
valuePathDidChange: Ember.observer(function() {
|
23406
|
-
var valuePath = get(this, 'parentView.optionValuePath');
|
23407
|
-
|
23408
|
-
if (!valuePath) { return; }
|
23409
|
-
|
23410
|
-
Ember.defineProperty(this, 'value', Ember.computed(function() {
|
23411
|
-
return get(this, valuePath);
|
23412
|
-
}).property(valuePath));
|
23413
|
-
}, 'parentView.optionValuePath')
|
23414
|
-
});
|
23415
|
-
|
23416
23983
|
})();
|
23417
23984
|
|
23418
23985
|
|
@@ -23427,6 +23994,15 @@ function normalizeHash(hash, hashTypes) {
|
|
23427
23994
|
}
|
23428
23995
|
}
|
23429
23996
|
|
23997
|
+
/**
|
23998
|
+
* `{{input}}` inserts a new instance of either Ember.TextField or
|
23999
|
+
* Ember.Checkbox, depending on the `type` option passed in. If no `type`
|
24000
|
+
* is supplied it defaults to Ember.TextField.
|
24001
|
+
*
|
24002
|
+
* @method input
|
24003
|
+
* @for Ember.Handlebars.helpers
|
24004
|
+
* @param {Hash} options
|
24005
|
+
*/
|
23430
24006
|
Ember.Handlebars.registerHelper('input', function(options) {
|
23431
24007
|
Ember.assert('You can only pass attributes to the `input` helper, not arguments', arguments.length < 2);
|
23432
24008
|
|
@@ -23449,8 +24025,16 @@ Ember.Handlebars.registerHelper('input', function(options) {
|
|
23449
24025
|
}
|
23450
24026
|
});
|
23451
24027
|
|
24028
|
+
/**
|
24029
|
+
* `{{textarea}}` inserts a new instance of Ember.TextArea into the template
|
24030
|
+
* passing its options to `Ember.TextArea`'s `create` method.
|
24031
|
+
*
|
24032
|
+
* @method textarea
|
24033
|
+
* @for Ember.Handlebars.helpers
|
24034
|
+
* @param {Hash} options
|
24035
|
+
*/
|
23452
24036
|
Ember.Handlebars.registerHelper('textarea', function(options) {
|
23453
|
-
Ember.assert('You can only pass attributes to the `
|
24037
|
+
Ember.assert('You can only pass attributes to the `textarea` helper, not arguments', arguments.length < 2);
|
23454
24038
|
|
23455
24039
|
var hash = options.hash,
|
23456
24040
|
types = options.hashTypes;
|
@@ -23458,6 +24042,7 @@ Ember.Handlebars.registerHelper('textarea', function(options) {
|
|
23458
24042
|
normalizeHash(hash, types);
|
23459
24043
|
return Ember.Handlebars.helpers.view.call(this, Ember.TextArea, options);
|
23460
24044
|
});
|
24045
|
+
|
23461
24046
|
})();
|
23462
24047
|
|
23463
24048
|
|
@@ -25348,15 +25933,6 @@ Ember.Location.registerImplementation('history', Ember.HistoryLocation);
|
|
25348
25933
|
|
25349
25934
|
var get = Ember.get, set = Ember.set;
|
25350
25935
|
|
25351
|
-
var merge = function(original, hash) {
|
25352
|
-
for (var prop in hash) {
|
25353
|
-
if (!hash.hasOwnProperty(prop)) { continue; }
|
25354
|
-
if (original.hasOwnProperty(prop)) { continue; }
|
25355
|
-
|
25356
|
-
original[prop] = hash[prop];
|
25357
|
-
}
|
25358
|
-
};
|
25359
|
-
|
25360
25936
|
/**
|
25361
25937
|
`Ember.Router` is the subclass of `Ember.StateManager` responsible for
|
25362
25938
|
providing URL-based application state detection. The `Ember.Router` instance
|