ember-source 1.12.0 → 1.12.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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/dist/ember-template-compiler.js +1346 -393
- data/dist/ember-testing.js +27 -24
- data/dist/ember.debug.js +2197 -2189
- data/dist/ember.js +2197 -2189
- data/dist/ember.min.js +11 -11
- data/dist/ember.prod.js +2270 -2265
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 967fd4c0b9e67fc707dd08717957b0ef85fdc337
|
4
|
+
data.tar.gz: fead0d0c2d4858e255363e83994dd0792aafa1b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32711abf178f804836fc13536223bc2a324c296ad0c92f9fb188bb91b42c0d894aa45de1cd8f57a724165b4c0cc26a6223686f1cddfcdd47d4ae3df42ad38cea
|
7
|
+
data.tar.gz: bb445a1a8581528f56aac8a0a512c3e4967486a7eb08ca9214f96618c891e0a63b58428b62a1b4f304aa7b092870bba15ac57b51f3be7badd56faa2e0f0e6b37
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.12.
|
1
|
+
1.12.1
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
6
6
|
* @license Licensed under MIT license
|
7
7
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
8
|
-
* @version 1.12.
|
8
|
+
* @version 1.12.1
|
9
9
|
*/
|
10
10
|
|
11
11
|
(function() {
|
@@ -116,16 +116,6 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/utils', 'embe
|
|
116
116
|
|
117
117
|
exports._warnIfUsingStrippedFeatureFlags = _warnIfUsingStrippedFeatureFlags;
|
118
118
|
|
119
|
-
/**
|
120
|
-
Will call `Ember.warn()` if ENABLE_ALL_FEATURES, ENABLE_OPTIONAL_FEATURES, or
|
121
|
-
any specific FEATURES flag is truthy.
|
122
|
-
|
123
|
-
This method is called automatically in debug canary builds.
|
124
|
-
|
125
|
-
@private
|
126
|
-
@method _warnIfUsingStrippedFeatureFlags
|
127
|
-
@return {void}
|
128
|
-
*/
|
129
119
|
Ember['default'].assert = function (desc, test) {
|
130
120
|
var throwAssertion;
|
131
121
|
|
@@ -285,6 +275,17 @@ enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/utils', 'embe
|
|
285
275
|
Ember['default'].runInDebug = function (func) {
|
286
276
|
func();
|
287
277
|
};
|
278
|
+
|
279
|
+
/**
|
280
|
+
Will call `Ember.warn()` if ENABLE_ALL_FEATURES, ENABLE_OPTIONAL_FEATURES, or
|
281
|
+
any specific FEATURES flag is truthy.
|
282
|
+
|
283
|
+
This method is called automatically in debug canary builds.
|
284
|
+
|
285
|
+
@private
|
286
|
+
@method _warnIfUsingStrippedFeatureFlags
|
287
|
+
@return {void}
|
288
|
+
*/
|
288
289
|
function _warnIfUsingStrippedFeatureFlags(FEATURES, featuresWereStripped) {
|
289
290
|
if (featuresWereStripped) {
|
290
291
|
Ember['default'].warn("Ember.ENV.ENABLE_ALL_FEATURES is only available in canary builds.", !Ember['default'].ENV.ENABLE_ALL_FEATURES);
|
@@ -789,150 +790,6 @@ enifed('ember-metal/binding', ['exports', 'ember-metal/core', 'ember-metal/prope
|
|
789
790
|
exports.oneWay = oneWay;
|
790
791
|
exports.Binding = Binding;
|
791
792
|
|
792
|
-
/**
|
793
|
-
An `Ember.Binding` connects the properties of two objects so that whenever
|
794
|
-
the value of one property changes, the other property will be changed also.
|
795
|
-
|
796
|
-
## Automatic Creation of Bindings with `/^*Binding/`-named Properties
|
797
|
-
|
798
|
-
You do not usually create Binding objects directly but instead describe
|
799
|
-
bindings in your class or object definition using automatic binding
|
800
|
-
detection.
|
801
|
-
|
802
|
-
Properties ending in a `Binding` suffix will be converted to `Ember.Binding`
|
803
|
-
instances. The value of this property should be a string representing a path
|
804
|
-
to another object or a custom binding instance created using Binding helpers
|
805
|
-
(see "One Way Bindings"):
|
806
|
-
|
807
|
-
```
|
808
|
-
valueBinding: "MyApp.someController.title"
|
809
|
-
```
|
810
|
-
|
811
|
-
This will create a binding from `MyApp.someController.title` to the `value`
|
812
|
-
property of your object instance automatically. Now the two values will be
|
813
|
-
kept in sync.
|
814
|
-
|
815
|
-
## One Way Bindings
|
816
|
-
|
817
|
-
One especially useful binding customization you can use is the `oneWay()`
|
818
|
-
helper. This helper tells Ember that you are only interested in
|
819
|
-
receiving changes on the object you are binding from. For example, if you
|
820
|
-
are binding to a preference and you want to be notified if the preference
|
821
|
-
has changed, but your object will not be changing the preference itself, you
|
822
|
-
could do:
|
823
|
-
|
824
|
-
```
|
825
|
-
bigTitlesBinding: Ember.Binding.oneWay("MyApp.preferencesController.bigTitles")
|
826
|
-
```
|
827
|
-
|
828
|
-
This way if the value of `MyApp.preferencesController.bigTitles` changes the
|
829
|
-
`bigTitles` property of your object will change also. However, if you
|
830
|
-
change the value of your `bigTitles` property, it will not update the
|
831
|
-
`preferencesController`.
|
832
|
-
|
833
|
-
One way bindings are almost twice as fast to setup and twice as fast to
|
834
|
-
execute because the binding only has to worry about changes to one side.
|
835
|
-
|
836
|
-
You should consider using one way bindings anytime you have an object that
|
837
|
-
may be created frequently and you do not intend to change a property; only
|
838
|
-
to monitor it for changes (such as in the example above).
|
839
|
-
|
840
|
-
## Adding Bindings Manually
|
841
|
-
|
842
|
-
All of the examples above show you how to configure a custom binding, but the
|
843
|
-
result of these customizations will be a binding template, not a fully active
|
844
|
-
Binding instance. The binding will actually become active only when you
|
845
|
-
instantiate the object the binding belongs to. It is useful however, to
|
846
|
-
understand what actually happens when the binding is activated.
|
847
|
-
|
848
|
-
For a binding to function it must have at least a `from` property and a `to`
|
849
|
-
property. The `from` property path points to the object/key that you want to
|
850
|
-
bind from while the `to` path points to the object/key you want to bind to.
|
851
|
-
|
852
|
-
When you define a custom binding, you are usually describing the property
|
853
|
-
you want to bind from (such as `MyApp.someController.value` in the examples
|
854
|
-
above). When your object is created, it will automatically assign the value
|
855
|
-
you want to bind `to` based on the name of your binding key. In the
|
856
|
-
examples above, during init, Ember objects will effectively call
|
857
|
-
something like this on your binding:
|
858
|
-
|
859
|
-
```javascript
|
860
|
-
binding = Ember.Binding.from("valueBinding").to("value");
|
861
|
-
```
|
862
|
-
|
863
|
-
This creates a new binding instance based on the template you provide, and
|
864
|
-
sets the to path to the `value` property of the new object. Now that the
|
865
|
-
binding is fully configured with a `from` and a `to`, it simply needs to be
|
866
|
-
connected to become active. This is done through the `connect()` method:
|
867
|
-
|
868
|
-
```javascript
|
869
|
-
binding.connect(this);
|
870
|
-
```
|
871
|
-
|
872
|
-
Note that when you connect a binding you pass the object you want it to be
|
873
|
-
connected to. This object will be used as the root for both the from and
|
874
|
-
to side of the binding when inspecting relative paths. This allows the
|
875
|
-
binding to be automatically inherited by subclassed objects as well.
|
876
|
-
|
877
|
-
This also allows you to bind between objects using the paths you declare in
|
878
|
-
`from` and `to`:
|
879
|
-
|
880
|
-
```javascript
|
881
|
-
// Example 1
|
882
|
-
binding = Ember.Binding.from("App.someObject.value").to("value");
|
883
|
-
binding.connect(this);
|
884
|
-
|
885
|
-
// Example 2
|
886
|
-
binding = Ember.Binding.from("parentView.value").to("App.someObject.value");
|
887
|
-
binding.connect(this);
|
888
|
-
```
|
889
|
-
|
890
|
-
Now that the binding is connected, it will observe both the from and to side
|
891
|
-
and relay changes.
|
892
|
-
|
893
|
-
If you ever needed to do so (you almost never will, but it is useful to
|
894
|
-
understand this anyway), you could manually create an active binding by
|
895
|
-
using the `Ember.bind()` helper method. (This is the same method used by
|
896
|
-
to setup your bindings on objects):
|
897
|
-
|
898
|
-
```javascript
|
899
|
-
Ember.bind(MyApp.anotherObject, "value", "MyApp.someController.value");
|
900
|
-
```
|
901
|
-
|
902
|
-
Both of these code fragments have the same effect as doing the most friendly
|
903
|
-
form of binding creation like so:
|
904
|
-
|
905
|
-
```javascript
|
906
|
-
MyApp.anotherObject = Ember.Object.create({
|
907
|
-
valueBinding: "MyApp.someController.value",
|
908
|
-
|
909
|
-
// OTHER CODE FOR THIS OBJECT...
|
910
|
-
});
|
911
|
-
```
|
912
|
-
|
913
|
-
Ember's built in binding creation method makes it easy to automatically
|
914
|
-
create bindings for you. You should always use the highest-level APIs
|
915
|
-
available, even if you understand how it works underneath.
|
916
|
-
|
917
|
-
@class Binding
|
918
|
-
@namespace Ember
|
919
|
-
@since Ember 0.9
|
920
|
-
*/
|
921
|
-
// Ember.Binding = Binding; ES6TODO: where to put this?
|
922
|
-
|
923
|
-
/**
|
924
|
-
Global helper method to create a new binding. Just pass the root object
|
925
|
-
along with a `to` and `from` path to create and connect the binding.
|
926
|
-
|
927
|
-
@method bind
|
928
|
-
@for Ember
|
929
|
-
@param {Object} obj The root object of the transform.
|
930
|
-
@param {String} to The path to the 'to' side of the binding.
|
931
|
-
Must be relative to obj.
|
932
|
-
@param {String} from The path to the 'from' side of the binding.
|
933
|
-
Must be relative to obj or a global path.
|
934
|
-
@return {Ember.Binding} binding instance
|
935
|
-
*/
|
936
793
|
Ember['default'].LOG_BINDINGS = false || !!Ember['default'].ENV.LOG_BINDINGS;
|
937
794
|
|
938
795
|
/**
|
@@ -1220,10 +1077,164 @@ enifed('ember-metal/binding', ['exports', 'ember-metal/core', 'ember-metal/prope
|
|
1220
1077
|
}
|
1221
1078
|
|
1222
1079
|
});
|
1080
|
+
/**
|
1081
|
+
An `Ember.Binding` connects the properties of two objects so that whenever
|
1082
|
+
the value of one property changes, the other property will be changed also.
|
1083
|
+
|
1084
|
+
## Automatic Creation of Bindings with `/^*Binding/`-named Properties
|
1085
|
+
|
1086
|
+
You do not usually create Binding objects directly but instead describe
|
1087
|
+
bindings in your class or object definition using automatic binding
|
1088
|
+
detection.
|
1089
|
+
|
1090
|
+
Properties ending in a `Binding` suffix will be converted to `Ember.Binding`
|
1091
|
+
instances. The value of this property should be a string representing a path
|
1092
|
+
to another object or a custom binding instance created using Binding helpers
|
1093
|
+
(see "One Way Bindings"):
|
1094
|
+
|
1095
|
+
```
|
1096
|
+
valueBinding: "MyApp.someController.title"
|
1097
|
+
```
|
1098
|
+
|
1099
|
+
This will create a binding from `MyApp.someController.title` to the `value`
|
1100
|
+
property of your object instance automatically. Now the two values will be
|
1101
|
+
kept in sync.
|
1102
|
+
|
1103
|
+
## One Way Bindings
|
1104
|
+
|
1105
|
+
One especially useful binding customization you can use is the `oneWay()`
|
1106
|
+
helper. This helper tells Ember that you are only interested in
|
1107
|
+
receiving changes on the object you are binding from. For example, if you
|
1108
|
+
are binding to a preference and you want to be notified if the preference
|
1109
|
+
has changed, but your object will not be changing the preference itself, you
|
1110
|
+
could do:
|
1111
|
+
|
1112
|
+
```
|
1113
|
+
bigTitlesBinding: Ember.Binding.oneWay("MyApp.preferencesController.bigTitles")
|
1114
|
+
```
|
1115
|
+
|
1116
|
+
This way if the value of `MyApp.preferencesController.bigTitles` changes the
|
1117
|
+
`bigTitles` property of your object will change also. However, if you
|
1118
|
+
change the value of your `bigTitles` property, it will not update the
|
1119
|
+
`preferencesController`.
|
1120
|
+
|
1121
|
+
One way bindings are almost twice as fast to setup and twice as fast to
|
1122
|
+
execute because the binding only has to worry about changes to one side.
|
1123
|
+
|
1124
|
+
You should consider using one way bindings anytime you have an object that
|
1125
|
+
may be created frequently and you do not intend to change a property; only
|
1126
|
+
to monitor it for changes (such as in the example above).
|
1127
|
+
|
1128
|
+
## Adding Bindings Manually
|
1129
|
+
|
1130
|
+
All of the examples above show you how to configure a custom binding, but the
|
1131
|
+
result of these customizations will be a binding template, not a fully active
|
1132
|
+
Binding instance. The binding will actually become active only when you
|
1133
|
+
instantiate the object the binding belongs to. It is useful however, to
|
1134
|
+
understand what actually happens when the binding is activated.
|
1135
|
+
|
1136
|
+
For a binding to function it must have at least a `from` property and a `to`
|
1137
|
+
property. The `from` property path points to the object/key that you want to
|
1138
|
+
bind from while the `to` path points to the object/key you want to bind to.
|
1139
|
+
|
1140
|
+
When you define a custom binding, you are usually describing the property
|
1141
|
+
you want to bind from (such as `MyApp.someController.value` in the examples
|
1142
|
+
above). When your object is created, it will automatically assign the value
|
1143
|
+
you want to bind `to` based on the name of your binding key. In the
|
1144
|
+
examples above, during init, Ember objects will effectively call
|
1145
|
+
something like this on your binding:
|
1146
|
+
|
1147
|
+
```javascript
|
1148
|
+
binding = Ember.Binding.from("valueBinding").to("value");
|
1149
|
+
```
|
1150
|
+
|
1151
|
+
This creates a new binding instance based on the template you provide, and
|
1152
|
+
sets the to path to the `value` property of the new object. Now that the
|
1153
|
+
binding is fully configured with a `from` and a `to`, it simply needs to be
|
1154
|
+
connected to become active. This is done through the `connect()` method:
|
1155
|
+
|
1156
|
+
```javascript
|
1157
|
+
binding.connect(this);
|
1158
|
+
```
|
1159
|
+
|
1160
|
+
Note that when you connect a binding you pass the object you want it to be
|
1161
|
+
connected to. This object will be used as the root for both the from and
|
1162
|
+
to side of the binding when inspecting relative paths. This allows the
|
1163
|
+
binding to be automatically inherited by subclassed objects as well.
|
1164
|
+
|
1165
|
+
This also allows you to bind between objects using the paths you declare in
|
1166
|
+
`from` and `to`:
|
1167
|
+
|
1168
|
+
```javascript
|
1169
|
+
// Example 1
|
1170
|
+
binding = Ember.Binding.from("App.someObject.value").to("value");
|
1171
|
+
binding.connect(this);
|
1172
|
+
|
1173
|
+
// Example 2
|
1174
|
+
binding = Ember.Binding.from("parentView.value").to("App.someObject.value");
|
1175
|
+
binding.connect(this);
|
1176
|
+
```
|
1177
|
+
|
1178
|
+
Now that the binding is connected, it will observe both the from and to side
|
1179
|
+
and relay changes.
|
1180
|
+
|
1181
|
+
If you ever needed to do so (you almost never will, but it is useful to
|
1182
|
+
understand this anyway), you could manually create an active binding by
|
1183
|
+
using the `Ember.bind()` helper method. (This is the same method used by
|
1184
|
+
to setup your bindings on objects):
|
1185
|
+
|
1186
|
+
```javascript
|
1187
|
+
Ember.bind(MyApp.anotherObject, "value", "MyApp.someController.value");
|
1188
|
+
```
|
1189
|
+
|
1190
|
+
Both of these code fragments have the same effect as doing the most friendly
|
1191
|
+
form of binding creation like so:
|
1192
|
+
|
1193
|
+
```javascript
|
1194
|
+
MyApp.anotherObject = Ember.Object.create({
|
1195
|
+
valueBinding: "MyApp.someController.value",
|
1196
|
+
|
1197
|
+
// OTHER CODE FOR THIS OBJECT...
|
1198
|
+
});
|
1199
|
+
```
|
1200
|
+
|
1201
|
+
Ember's built in binding creation method makes it easy to automatically
|
1202
|
+
create bindings for you. You should always use the highest-level APIs
|
1203
|
+
available, even if you understand how it works underneath.
|
1204
|
+
|
1205
|
+
@class Binding
|
1206
|
+
@namespace Ember
|
1207
|
+
@since Ember 0.9
|
1208
|
+
*/
|
1209
|
+
// Ember.Binding = Binding; ES6TODO: where to put this?
|
1210
|
+
|
1211
|
+
/**
|
1212
|
+
Global helper method to create a new binding. Just pass the root object
|
1213
|
+
along with a `to` and `from` path to create and connect the binding.
|
1214
|
+
|
1215
|
+
@method bind
|
1216
|
+
@for Ember
|
1217
|
+
@param {Object} obj The root object of the transform.
|
1218
|
+
@param {String} to The path to the 'to' side of the binding.
|
1219
|
+
Must be relative to obj.
|
1220
|
+
@param {String} from The path to the 'from' side of the binding.
|
1221
|
+
Must be relative to obj or a global path.
|
1222
|
+
@return {Ember.Binding} binding instance
|
1223
|
+
*/
|
1223
1224
|
function bind(obj, to, from) {
|
1224
1225
|
return new Binding(to, from).connect(obj);
|
1225
1226
|
}
|
1226
1227
|
|
1228
|
+
/**
|
1229
|
+
@method oneWay
|
1230
|
+
@for Ember
|
1231
|
+
@param {Object} obj The root object of the transform.
|
1232
|
+
@param {String} to The path to the 'to' side of the binding.
|
1233
|
+
Must be relative to obj.
|
1234
|
+
@param {String} from The path to the 'from' side of the binding.
|
1235
|
+
Must be relative to obj or a global path.
|
1236
|
+
@return {Ember.Binding} binding instance
|
1237
|
+
*/
|
1227
1238
|
function oneWay(obj, to, from) {
|
1228
1239
|
return new Binding(to, from).oneWay().connect(obj);
|
1229
1240
|
}
|
@@ -1297,9 +1308,6 @@ enifed('ember-metal/chains', ['exports', 'ember-metal/core', 'ember-metal/proper
|
|
1297
1308
|
exports.removeChainWatcher = removeChainWatcher;
|
1298
1309
|
exports.ChainNode = ChainNode;
|
1299
1310
|
|
1300
|
-
// attempts to add the pendingQueue chains again. If some of them end up
|
1301
|
-
// back in the queue and reschedule is true, schedules a timeout to try
|
1302
|
-
// again.
|
1303
1311
|
var warn = Ember['default'].warn;
|
1304
1312
|
var FIRST_KEY = /^([^\.]+)/;
|
1305
1313
|
|
@@ -1311,7 +1319,12 @@ enifed('ember-metal/chains', ['exports', 'ember-metal/core', 'ember-metal/proper
|
|
1311
1319
|
return obj && typeof obj === "object";
|
1312
1320
|
}
|
1313
1321
|
|
1314
|
-
var pendingQueue = [];
|
1322
|
+
var pendingQueue = [];
|
1323
|
+
|
1324
|
+
// attempts to add the pendingQueue chains again. If some of them end up
|
1325
|
+
// back in the queue and reschedule is true, schedules a timeout to try
|
1326
|
+
// again.
|
1327
|
+
|
1315
1328
|
function flushPendingChains() {
|
1316
1329
|
if (pendingQueue.length === 0) {
|
1317
1330
|
return;
|
@@ -2335,6 +2348,28 @@ enifed('ember-metal/computed_macros', ['exports', 'ember-metal/core', 'ember-met
|
|
2335
2348
|
exports.defaultTo = defaultTo;
|
2336
2349
|
exports.deprecatingAlias = deprecatingAlias;
|
2337
2350
|
|
2351
|
+
function getProperties(self, propertyNames) {
|
2352
|
+
var ret = {};
|
2353
|
+
for (var i = 0; i < propertyNames.length; i++) {
|
2354
|
+
ret[propertyNames[i]] = property_get.get(self, propertyNames[i]);
|
2355
|
+
}
|
2356
|
+
return ret;
|
2357
|
+
}
|
2358
|
+
|
2359
|
+
function generateComputedWithProperties(macro) {
|
2360
|
+
return function () {
|
2361
|
+
for (var _len = arguments.length, properties = Array(_len), _key = 0; _key < _len; _key++) {
|
2362
|
+
properties[_key] = arguments[_key];
|
2363
|
+
}
|
2364
|
+
|
2365
|
+
var computedFunc = computed.computed(function () {
|
2366
|
+
return macro.apply(this, [getProperties(this, properties)]);
|
2367
|
+
});
|
2368
|
+
|
2369
|
+
return computedFunc.property.apply(computedFunc, properties);
|
2370
|
+
};
|
2371
|
+
}
|
2372
|
+
|
2338
2373
|
/**
|
2339
2374
|
A computed property that returns true if the value of the dependent
|
2340
2375
|
property is null, an empty string, empty array, or empty function.
|
@@ -2362,57 +2397,165 @@ enifed('ember-metal/computed_macros', ['exports', 'ember-metal/core', 'ember-met
|
|
2362
2397
|
@return {Ember.ComputedProperty} computed property which negate
|
2363
2398
|
the original value for property
|
2364
2399
|
*/
|
2365
|
-
function getProperties(self, propertyNames) {
|
2366
|
-
var ret = {};
|
2367
|
-
for (var i = 0; i < propertyNames.length; i++) {
|
2368
|
-
ret[propertyNames[i]] = property_get.get(self, propertyNames[i]);
|
2369
|
-
}
|
2370
|
-
return ret;
|
2371
|
-
}
|
2372
|
-
|
2373
|
-
function generateComputedWithProperties(macro) {
|
2374
|
-
return function () {
|
2375
|
-
for (var _len = arguments.length, properties = Array(_len), _key = 0; _key < _len; _key++) {
|
2376
|
-
properties[_key] = arguments[_key];
|
2377
|
-
}
|
2378
|
-
|
2379
|
-
var computedFunc = computed.computed(function () {
|
2380
|
-
return macro.apply(this, [getProperties(this, properties)]);
|
2381
|
-
});
|
2382
|
-
|
2383
|
-
return computedFunc.property.apply(computedFunc, properties);
|
2384
|
-
};
|
2385
|
-
}
|
2386
2400
|
function empty(dependentKey) {
|
2387
2401
|
return computed.computed(dependentKey + ".length", function () {
|
2388
2402
|
return isEmpty['default'](property_get.get(this, dependentKey));
|
2389
2403
|
});
|
2390
2404
|
}
|
2391
2405
|
|
2406
|
+
/**
|
2407
|
+
A computed property that returns true if the value of the dependent
|
2408
|
+
property is NOT null, an empty string, empty array, or empty function.
|
2409
|
+
|
2410
|
+
Example
|
2411
|
+
|
2412
|
+
```javascript
|
2413
|
+
var Hamster = Ember.Object.extend({
|
2414
|
+
hasStuff: Ember.computed.notEmpty('backpack')
|
2415
|
+
});
|
2416
|
+
|
2417
|
+
var hamster = Hamster.create({ backpack: ['Food', 'Sleeping Bag', 'Tent'] });
|
2418
|
+
|
2419
|
+
hamster.get('hasStuff'); // true
|
2420
|
+
hamster.get('backpack').clear(); // []
|
2421
|
+
hamster.get('hasStuff'); // false
|
2422
|
+
```
|
2423
|
+
|
2424
|
+
@method notEmpty
|
2425
|
+
@for Ember.computed
|
2426
|
+
@param {String} dependentKey
|
2427
|
+
@return {Ember.ComputedProperty} computed property which returns true if
|
2428
|
+
original value for property is not empty.
|
2429
|
+
*/
|
2392
2430
|
function notEmpty(dependentKey) {
|
2393
2431
|
return computed.computed(dependentKey + ".length", function () {
|
2394
2432
|
return !isEmpty['default'](property_get.get(this, dependentKey));
|
2395
2433
|
});
|
2396
2434
|
}
|
2397
2435
|
|
2436
|
+
/**
|
2437
|
+
A computed property that returns true if the value of the dependent
|
2438
|
+
property is null or undefined. This avoids errors from JSLint complaining
|
2439
|
+
about use of ==, which can be technically confusing.
|
2440
|
+
|
2441
|
+
Example
|
2442
|
+
|
2443
|
+
```javascript
|
2444
|
+
var Hamster = Ember.Object.extend({
|
2445
|
+
isHungry: Ember.computed.none('food')
|
2446
|
+
});
|
2447
|
+
|
2448
|
+
var hamster = Hamster.create();
|
2449
|
+
|
2450
|
+
hamster.get('isHungry'); // true
|
2451
|
+
hamster.set('food', 'Banana');
|
2452
|
+
hamster.get('isHungry'); // false
|
2453
|
+
hamster.set('food', null);
|
2454
|
+
hamster.get('isHungry'); // true
|
2455
|
+
```
|
2456
|
+
|
2457
|
+
@method none
|
2458
|
+
@for Ember.computed
|
2459
|
+
@param {String} dependentKey
|
2460
|
+
@return {Ember.ComputedProperty} computed property which
|
2461
|
+
returns true if original value for property is null or undefined.
|
2462
|
+
*/
|
2398
2463
|
function none(dependentKey) {
|
2399
2464
|
return computed.computed(dependentKey, function () {
|
2400
2465
|
return isNone['default'](property_get.get(this, dependentKey));
|
2401
2466
|
});
|
2402
2467
|
}
|
2403
2468
|
|
2469
|
+
/**
|
2470
|
+
A computed property that returns the inverse boolean value
|
2471
|
+
of the original value for the dependent property.
|
2472
|
+
|
2473
|
+
Example
|
2474
|
+
|
2475
|
+
```javascript
|
2476
|
+
var User = Ember.Object.extend({
|
2477
|
+
isAnonymous: Ember.computed.not('loggedIn')
|
2478
|
+
});
|
2479
|
+
|
2480
|
+
var user = User.create({loggedIn: false});
|
2481
|
+
|
2482
|
+
user.get('isAnonymous'); // true
|
2483
|
+
user.set('loggedIn', true);
|
2484
|
+
user.get('isAnonymous'); // false
|
2485
|
+
```
|
2486
|
+
|
2487
|
+
@method not
|
2488
|
+
@for Ember.computed
|
2489
|
+
@param {String} dependentKey
|
2490
|
+
@return {Ember.ComputedProperty} computed property which returns
|
2491
|
+
inverse of the original value for property
|
2492
|
+
*/
|
2404
2493
|
function not(dependentKey) {
|
2405
2494
|
return computed.computed(dependentKey, function () {
|
2406
2495
|
return !property_get.get(this, dependentKey);
|
2407
2496
|
});
|
2408
2497
|
}
|
2409
2498
|
|
2499
|
+
/**
|
2500
|
+
A computed property that converts the provided dependent property
|
2501
|
+
into a boolean value.
|
2502
|
+
|
2503
|
+
```javascript
|
2504
|
+
var Hamster = Ember.Object.extend({
|
2505
|
+
hasBananas: Ember.computed.bool('numBananas')
|
2506
|
+
});
|
2507
|
+
|
2508
|
+
var hamster = Hamster.create();
|
2509
|
+
|
2510
|
+
hamster.get('hasBananas'); // false
|
2511
|
+
hamster.set('numBananas', 0);
|
2512
|
+
hamster.get('hasBananas'); // false
|
2513
|
+
hamster.set('numBananas', 1);
|
2514
|
+
hamster.get('hasBananas'); // true
|
2515
|
+
hamster.set('numBananas', null);
|
2516
|
+
hamster.get('hasBananas'); // false
|
2517
|
+
```
|
2518
|
+
|
2519
|
+
@method bool
|
2520
|
+
@for Ember.computed
|
2521
|
+
@param {String} dependentKey
|
2522
|
+
@return {Ember.ComputedProperty} computed property which converts
|
2523
|
+
to boolean the original value for property
|
2524
|
+
*/
|
2410
2525
|
function bool(dependentKey) {
|
2411
2526
|
return computed.computed(dependentKey, function () {
|
2412
2527
|
return !!property_get.get(this, dependentKey);
|
2413
2528
|
});
|
2414
2529
|
}
|
2415
2530
|
|
2531
|
+
/**
|
2532
|
+
A computed property which matches the original value for the
|
2533
|
+
dependent property against a given RegExp, returning `true`
|
2534
|
+
if they values matches the RegExp and `false` if it does not.
|
2535
|
+
|
2536
|
+
Example
|
2537
|
+
|
2538
|
+
```javascript
|
2539
|
+
var User = Ember.Object.extend({
|
2540
|
+
hasValidEmail: Ember.computed.match('email', /^.+@.+\..+$/)
|
2541
|
+
});
|
2542
|
+
|
2543
|
+
var user = User.create({loggedIn: false});
|
2544
|
+
|
2545
|
+
user.get('hasValidEmail'); // false
|
2546
|
+
user.set('email', '');
|
2547
|
+
user.get('hasValidEmail'); // false
|
2548
|
+
user.set('email', 'ember_hamster@example.com');
|
2549
|
+
user.get('hasValidEmail'); // true
|
2550
|
+
```
|
2551
|
+
|
2552
|
+
@method match
|
2553
|
+
@for Ember.computed
|
2554
|
+
@param {String} dependentKey
|
2555
|
+
@param {RegExp} regexp
|
2556
|
+
@return {Ember.ComputedProperty} computed property which match
|
2557
|
+
the original value for property against a given RegExp
|
2558
|
+
*/
|
2416
2559
|
function match(dependentKey, regexp) {
|
2417
2560
|
return computed.computed(dependentKey, function () {
|
2418
2561
|
var value = property_get.get(this, dependentKey);
|
@@ -2421,30 +2564,165 @@ enifed('ember-metal/computed_macros', ['exports', 'ember-metal/core', 'ember-met
|
|
2421
2564
|
});
|
2422
2565
|
}
|
2423
2566
|
|
2567
|
+
/**
|
2568
|
+
A computed property that returns true if the provided dependent property
|
2569
|
+
is equal to the given value.
|
2570
|
+
|
2571
|
+
Example
|
2572
|
+
|
2573
|
+
```javascript
|
2574
|
+
var Hamster = Ember.Object.extend({
|
2575
|
+
napTime: Ember.computed.equal('state', 'sleepy')
|
2576
|
+
});
|
2577
|
+
|
2578
|
+
var hamster = Hamster.create();
|
2579
|
+
|
2580
|
+
hamster.get('napTime'); // false
|
2581
|
+
hamster.set('state', 'sleepy');
|
2582
|
+
hamster.get('napTime'); // true
|
2583
|
+
hamster.set('state', 'hungry');
|
2584
|
+
hamster.get('napTime'); // false
|
2585
|
+
```
|
2586
|
+
|
2587
|
+
@method equal
|
2588
|
+
@for Ember.computed
|
2589
|
+
@param {String} dependentKey
|
2590
|
+
@param {String|Number|Object} value
|
2591
|
+
@return {Ember.ComputedProperty} computed property which returns true if
|
2592
|
+
the original value for property is equal to the given value.
|
2593
|
+
*/
|
2424
2594
|
function equal(dependentKey, value) {
|
2425
2595
|
return computed.computed(dependentKey, function () {
|
2426
2596
|
return property_get.get(this, dependentKey) === value;
|
2427
2597
|
});
|
2428
2598
|
}
|
2429
2599
|
|
2600
|
+
/**
|
2601
|
+
A computed property that returns true if the provided dependent property
|
2602
|
+
is greater than the provided value.
|
2603
|
+
|
2604
|
+
Example
|
2605
|
+
|
2606
|
+
```javascript
|
2607
|
+
var Hamster = Ember.Object.extend({
|
2608
|
+
hasTooManyBananas: Ember.computed.gt('numBananas', 10)
|
2609
|
+
});
|
2610
|
+
|
2611
|
+
var hamster = Hamster.create();
|
2612
|
+
|
2613
|
+
hamster.get('hasTooManyBananas'); // false
|
2614
|
+
hamster.set('numBananas', 3);
|
2615
|
+
hamster.get('hasTooManyBananas'); // false
|
2616
|
+
hamster.set('numBananas', 11);
|
2617
|
+
hamster.get('hasTooManyBananas'); // true
|
2618
|
+
```
|
2619
|
+
|
2620
|
+
@method gt
|
2621
|
+
@for Ember.computed
|
2622
|
+
@param {String} dependentKey
|
2623
|
+
@param {Number} value
|
2624
|
+
@return {Ember.ComputedProperty} computed property which returns true if
|
2625
|
+
the original value for property is greater than given value.
|
2626
|
+
*/
|
2430
2627
|
function gt(dependentKey, value) {
|
2431
2628
|
return computed.computed(dependentKey, function () {
|
2432
2629
|
return property_get.get(this, dependentKey) > value;
|
2433
2630
|
});
|
2434
2631
|
}
|
2435
2632
|
|
2633
|
+
/**
|
2634
|
+
A computed property that returns true if the provided dependent property
|
2635
|
+
is greater than or equal to the provided value.
|
2636
|
+
|
2637
|
+
Example
|
2638
|
+
|
2639
|
+
```javascript
|
2640
|
+
var Hamster = Ember.Object.extend({
|
2641
|
+
hasTooManyBananas: Ember.computed.gte('numBananas', 10)
|
2642
|
+
});
|
2643
|
+
|
2644
|
+
var hamster = Hamster.create();
|
2645
|
+
|
2646
|
+
hamster.get('hasTooManyBananas'); // false
|
2647
|
+
hamster.set('numBananas', 3);
|
2648
|
+
hamster.get('hasTooManyBananas'); // false
|
2649
|
+
hamster.set('numBananas', 10);
|
2650
|
+
hamster.get('hasTooManyBananas'); // true
|
2651
|
+
```
|
2652
|
+
|
2653
|
+
@method gte
|
2654
|
+
@for Ember.computed
|
2655
|
+
@param {String} dependentKey
|
2656
|
+
@param {Number} value
|
2657
|
+
@return {Ember.ComputedProperty} computed property which returns true if
|
2658
|
+
the original value for property is greater or equal then given value.
|
2659
|
+
*/
|
2436
2660
|
function gte(dependentKey, value) {
|
2437
2661
|
return computed.computed(dependentKey, function () {
|
2438
2662
|
return property_get.get(this, dependentKey) >= value;
|
2439
2663
|
});
|
2440
2664
|
}
|
2441
2665
|
|
2666
|
+
/**
|
2667
|
+
A computed property that returns true if the provided dependent property
|
2668
|
+
is less than the provided value.
|
2669
|
+
|
2670
|
+
Example
|
2671
|
+
|
2672
|
+
```javascript
|
2673
|
+
var Hamster = Ember.Object.extend({
|
2674
|
+
needsMoreBananas: Ember.computed.lt('numBananas', 3)
|
2675
|
+
});
|
2676
|
+
|
2677
|
+
var hamster = Hamster.create();
|
2678
|
+
|
2679
|
+
hamster.get('needsMoreBananas'); // true
|
2680
|
+
hamster.set('numBananas', 3);
|
2681
|
+
hamster.get('needsMoreBananas'); // false
|
2682
|
+
hamster.set('numBananas', 2);
|
2683
|
+
hamster.get('needsMoreBananas'); // true
|
2684
|
+
```
|
2685
|
+
|
2686
|
+
@method lt
|
2687
|
+
@for Ember.computed
|
2688
|
+
@param {String} dependentKey
|
2689
|
+
@param {Number} value
|
2690
|
+
@return {Ember.ComputedProperty} computed property which returns true if
|
2691
|
+
the original value for property is less then given value.
|
2692
|
+
*/
|
2442
2693
|
function lt(dependentKey, value) {
|
2443
2694
|
return computed.computed(dependentKey, function () {
|
2444
2695
|
return property_get.get(this, dependentKey) < value;
|
2445
2696
|
});
|
2446
2697
|
}
|
2447
2698
|
|
2699
|
+
/**
|
2700
|
+
A computed property that returns true if the provided dependent property
|
2701
|
+
is less than or equal to the provided value.
|
2702
|
+
|
2703
|
+
Example
|
2704
|
+
|
2705
|
+
```javascript
|
2706
|
+
var Hamster = Ember.Object.extend({
|
2707
|
+
needsMoreBananas: Ember.computed.lte('numBananas', 3)
|
2708
|
+
});
|
2709
|
+
|
2710
|
+
var hamster = Hamster.create();
|
2711
|
+
|
2712
|
+
hamster.get('needsMoreBananas'); // true
|
2713
|
+
hamster.set('numBananas', 5);
|
2714
|
+
hamster.get('needsMoreBananas'); // false
|
2715
|
+
hamster.set('numBananas', 3);
|
2716
|
+
hamster.get('needsMoreBananas'); // true
|
2717
|
+
```
|
2718
|
+
|
2719
|
+
@method lte
|
2720
|
+
@for Ember.computed
|
2721
|
+
@param {String} dependentKey
|
2722
|
+
@param {Number} value
|
2723
|
+
@return {Ember.ComputedProperty} computed property which returns true if
|
2724
|
+
the original value for property is less or equal than given value.
|
2725
|
+
*/
|
2448
2726
|
function lte(dependentKey, value) {
|
2449
2727
|
return computed.computed(dependentKey, function () {
|
2450
2728
|
return property_get.get(this, dependentKey) <= value;
|
@@ -2520,14 +2798,88 @@ enifed('ember-metal/computed_macros', ['exports', 'ember-metal/core', 'ember-met
|
|
2520
2798
|
}
|
2521
2799
|
}
|
2522
2800
|
return res;
|
2523
|
-
});
|
2801
|
+
});
|
2802
|
+
|
2803
|
+
function oneWay(dependentKey) {
|
2524
2804
|
return alias['default'](dependentKey).oneWay();
|
2525
2805
|
}
|
2526
2806
|
|
2807
|
+
/**
|
2808
|
+
This is a more semantically meaningful alias of `computed.oneWay`,
|
2809
|
+
whose name is somewhat ambiguous as to which direction the data flows.
|
2810
|
+
|
2811
|
+
@method reads
|
2812
|
+
@for Ember.computed
|
2813
|
+
@param {String} dependentKey
|
2814
|
+
@return {Ember.ComputedProperty} computed property which creates a
|
2815
|
+
one way computed property to the original value for property.
|
2816
|
+
*/
|
2817
|
+
|
2818
|
+
/**
|
2819
|
+
Where `computed.oneWay` provides oneWay bindings, `computed.readOnly` provides
|
2820
|
+
a readOnly one way binding. Very often when using `computed.oneWay` one does
|
2821
|
+
not also want changes to propagate back up, as they will replace the value.
|
2822
|
+
|
2823
|
+
This prevents the reverse flow, and also throws an exception when it occurs.
|
2824
|
+
|
2825
|
+
Example
|
2826
|
+
|
2827
|
+
```javascript
|
2828
|
+
var User = Ember.Object.extend({
|
2829
|
+
firstName: null,
|
2830
|
+
lastName: null,
|
2831
|
+
nickName: Ember.computed.readOnly('firstName')
|
2832
|
+
});
|
2833
|
+
|
2834
|
+
var teddy = User.create({
|
2835
|
+
firstName: 'Teddy',
|
2836
|
+
lastName: 'Zeenny'
|
2837
|
+
});
|
2838
|
+
|
2839
|
+
teddy.get('nickName'); // 'Teddy'
|
2840
|
+
teddy.set('nickName', 'TeddyBear'); // throws Exception
|
2841
|
+
// throw new Ember.Error('Cannot Set: nickName on: <User:ember27288>' );`
|
2842
|
+
teddy.get('firstName'); // 'Teddy'
|
2843
|
+
```
|
2844
|
+
|
2845
|
+
@method readOnly
|
2846
|
+
@for Ember.computed
|
2847
|
+
@param {String} dependentKey
|
2848
|
+
@return {Ember.ComputedProperty} computed property which creates a
|
2849
|
+
one way computed property to the original value for property.
|
2850
|
+
@since 1.5.0
|
2851
|
+
*/
|
2527
2852
|
function readOnly(dependentKey) {
|
2528
2853
|
return alias['default'](dependentKey).readOnly();
|
2529
2854
|
}
|
2530
2855
|
|
2856
|
+
/**
|
2857
|
+
A computed property that acts like a standard getter and setter,
|
2858
|
+
but returns the value at the provided `defaultPath` if the
|
2859
|
+
property itself has not been set to a value
|
2860
|
+
|
2861
|
+
Example
|
2862
|
+
|
2863
|
+
```javascript
|
2864
|
+
var Hamster = Ember.Object.extend({
|
2865
|
+
wishList: Ember.computed.defaultTo('favoriteFood')
|
2866
|
+
});
|
2867
|
+
|
2868
|
+
var hamster = Hamster.create({ favoriteFood: 'Banana' });
|
2869
|
+
|
2870
|
+
hamster.get('wishList'); // 'Banana'
|
2871
|
+
hamster.set('wishList', 'More Unit Tests');
|
2872
|
+
hamster.get('wishList'); // 'More Unit Tests'
|
2873
|
+
hamster.get('favoriteFood'); // 'Banana'
|
2874
|
+
```
|
2875
|
+
|
2876
|
+
@method defaultTo
|
2877
|
+
@for Ember.computed
|
2878
|
+
@param {String} defaultPath
|
2879
|
+
@return {Ember.ComputedProperty} computed property which acts like
|
2880
|
+
a standard getter and setter, but defaults to the value from `defaultPath`.
|
2881
|
+
@deprecated Use `Ember.computed.oneWay` or custom CP with default instead.
|
2882
|
+
*/
|
2531
2883
|
function defaultTo(defaultPath) {
|
2532
2884
|
return computed.computed({
|
2533
2885
|
get: function (key) {
|
@@ -2542,6 +2894,19 @@ enifed('ember-metal/computed_macros', ['exports', 'ember-metal/core', 'ember-met
|
|
2542
2894
|
});
|
2543
2895
|
}
|
2544
2896
|
|
2897
|
+
/**
|
2898
|
+
Creates a new property that is an alias for another property
|
2899
|
+
on an object. Calls to `get` or `set` this property behave as
|
2900
|
+
though they were called on the original property, but also
|
2901
|
+
print a deprecation warning.
|
2902
|
+
|
2903
|
+
@method deprecatingAlias
|
2904
|
+
@for Ember.computed
|
2905
|
+
@param {String} dependentKey
|
2906
|
+
@return {Ember.ComputedProperty} computed property which creates an
|
2907
|
+
alias with a deprecation to the original value for property.
|
2908
|
+
@since 1.7.0
|
2909
|
+
*/
|
2545
2910
|
function deprecatingAlias(dependentKey) {
|
2546
2911
|
return computed.computed(dependentKey, {
|
2547
2912
|
get: function (key) {
|
@@ -2592,7 +2957,7 @@ enifed('ember-metal/core', ['exports'], function (exports) {
|
|
2592
2957
|
|
2593
2958
|
@class Ember
|
2594
2959
|
@static
|
2595
|
-
@version 1.12.
|
2960
|
+
@version 1.12.1
|
2596
2961
|
*/
|
2597
2962
|
|
2598
2963
|
if ('undefined' === typeof Ember) {
|
@@ -2621,10 +2986,10 @@ enifed('ember-metal/core', ['exports'], function (exports) {
|
|
2621
2986
|
/**
|
2622
2987
|
@property VERSION
|
2623
2988
|
@type String
|
2624
|
-
@default '1.12.
|
2989
|
+
@default '1.12.1'
|
2625
2990
|
@static
|
2626
2991
|
*/
|
2627
|
-
Ember.VERSION = '1.12.
|
2992
|
+
Ember.VERSION = '1.12.1';
|
2628
2993
|
|
2629
2994
|
/**
|
2630
2995
|
Standard environmental variables. You can define these in a global `EmberENV`
|
@@ -2890,18 +3255,6 @@ enifed('ember-metal/deprecate_property', ['exports', 'ember-metal/core', 'ember-
|
|
2890
3255
|
|
2891
3256
|
exports.deprecateProperty = deprecateProperty;
|
2892
3257
|
|
2893
|
-
/**
|
2894
|
-
Used internally to allow changing properties in a backwards compatible way, and print a helpful
|
2895
|
-
deprecation warning.
|
2896
|
-
|
2897
|
-
@method deprecateProperty
|
2898
|
-
@param {Object} object The object to add the deprecated property to.
|
2899
|
-
@param {String} deprecatedKey The property to add (and print deprecation warnings upon accessing).
|
2900
|
-
@param {String} newKey The property that will be aliased.
|
2901
|
-
@private
|
2902
|
-
@since 1.7.0
|
2903
|
-
*/
|
2904
|
-
|
2905
3258
|
function deprecateProperty(object, deprecatedKey, newKey) {
|
2906
3259
|
function deprecate() {
|
2907
3260
|
Ember['default'].deprecate("Usage of `" + deprecatedKey + "` is deprecated, use `" + newKey + "` instead.");
|
@@ -2929,12 +3282,6 @@ enifed('ember-metal/dictionary', ['exports', 'ember-metal/platform/create'], fun
|
|
2929
3282
|
'use strict';
|
2930
3283
|
|
2931
3284
|
|
2932
|
-
|
2933
|
-
// the delete is meant to hint at runtimes that this object should remain in
|
2934
|
-
// dictionary mode. This is clearly a runtime specific hack, but currently it
|
2935
|
-
// appears worthwhile in some usecases. Please note, these deletes do increase
|
2936
|
-
// the cost of creation dramatically over a plain Object.create. And as this
|
2937
|
-
// only makes sense for long-lived dictionaries that aren't instantiated often.
|
2938
3285
|
exports['default'] = makeDictionary;
|
2939
3286
|
function makeDictionary(parent) {
|
2940
3287
|
var dict = create['default'](parent);
|
@@ -2959,6 +3306,8 @@ enifed('ember-metal/enumerable_utils', ['exports', 'ember-metal/array'], functio
|
|
2959
3306
|
exports.replace = replace;
|
2960
3307
|
exports.intersection = intersection;
|
2961
3308
|
|
3309
|
+
var splice = Array.prototype.splice;
|
3310
|
+
|
2962
3311
|
/**
|
2963
3312
|
* Defines some convenience methods for working with Enumerables.
|
2964
3313
|
* `Ember.EnumerableUtils` uses `Ember.ArrayPolyfills` when necessary.
|
@@ -2979,29 +3328,89 @@ enifed('ember-metal/enumerable_utils', ['exports', 'ember-metal/array'], functio
|
|
2979
3328
|
*
|
2980
3329
|
* @return {Array} An array of mapped values.
|
2981
3330
|
*/
|
2982
|
-
|
2983
|
-
|
2984
|
-
|
2985
|
-
|
2986
|
-
|
3331
|
+
function map(obj, callback, thisArg) {
|
3332
|
+
return obj.map ? obj.map(callback, thisArg) : ember_metal__array.map.call(obj, callback, thisArg);
|
3333
|
+
}
|
3334
|
+
|
3335
|
+
/**
|
3336
|
+
* Calls the forEach function on the passed object with a specified callback. This
|
3337
|
+
* uses `Ember.ArrayPolyfill`'s-forEach method when necessary.
|
3338
|
+
*
|
3339
|
+
* @method forEach
|
3340
|
+
* @param {Object} obj The object to call forEach on
|
3341
|
+
* @param {Function} callback The callback to execute
|
3342
|
+
* @param {Object} thisArg Value to use as this when executing *callback*
|
3343
|
+
*
|
3344
|
+
*/
|
2987
3345
|
function forEach(obj, callback, thisArg) {
|
2988
3346
|
return obj.forEach ? obj.forEach(callback, thisArg) : ember_metal__array.forEach.call(obj, callback, thisArg);
|
2989
3347
|
}
|
2990
3348
|
|
3349
|
+
/**
|
3350
|
+
* Calls the filter function on the passed object with a specified callback. This
|
3351
|
+
* uses `Ember.ArrayPolyfill`'s-filter method when necessary.
|
3352
|
+
*
|
3353
|
+
* @method filter
|
3354
|
+
* @param {Object} obj The object to call filter on
|
3355
|
+
* @param {Function} callback The callback to execute
|
3356
|
+
* @param {Object} thisArg Value to use as this when executing *callback*
|
3357
|
+
*
|
3358
|
+
* @return {Array} An array containing the filtered values
|
3359
|
+
* @since 1.4.0
|
3360
|
+
*/
|
2991
3361
|
function filter(obj, callback, thisArg) {
|
2992
3362
|
return obj.filter ? obj.filter(callback, thisArg) : ember_metal__array.filter.call(obj, callback, thisArg);
|
2993
3363
|
}
|
2994
3364
|
|
3365
|
+
/**
|
3366
|
+
* Calls the indexOf function on the passed object with a specified callback. This
|
3367
|
+
* uses `Ember.ArrayPolyfill`'s-indexOf method when necessary.
|
3368
|
+
*
|
3369
|
+
* @method indexOf
|
3370
|
+
* @param {Object} obj The object to call indexOn on
|
3371
|
+
* @param {Function} callback The callback to execute
|
3372
|
+
* @param {Object} index The index to start searching from
|
3373
|
+
*
|
3374
|
+
*/
|
2995
3375
|
function indexOf(obj, element, index) {
|
2996
3376
|
return obj.indexOf ? obj.indexOf(element, index) : ember_metal__array.indexOf.call(obj, element, index);
|
2997
3377
|
}
|
2998
3378
|
|
3379
|
+
/**
|
3380
|
+
* Returns an array of indexes of the first occurrences of the passed elements
|
3381
|
+
* on the passed object.
|
3382
|
+
*
|
3383
|
+
* ```javascript
|
3384
|
+
* var array = [1, 2, 3, 4, 5];
|
3385
|
+
* Ember.EnumerableUtils.indexesOf(array, [2, 5]); // [1, 4]
|
3386
|
+
*
|
3387
|
+
* var fubar = "Fubarr";
|
3388
|
+
* Ember.EnumerableUtils.indexesOf(fubar, ['b', 'r']); // [2, 4]
|
3389
|
+
* ```
|
3390
|
+
*
|
3391
|
+
* @method indexesOf
|
3392
|
+
* @param {Object} obj The object to check for element indexes
|
3393
|
+
* @param {Array} elements The elements to search for on *obj*
|
3394
|
+
*
|
3395
|
+
* @return {Array} An array of indexes.
|
3396
|
+
*
|
3397
|
+
*/
|
2999
3398
|
function indexesOf(obj, elements) {
|
3000
3399
|
return elements === undefined ? [] : map(elements, function (item) {
|
3001
3400
|
return indexOf(obj, item);
|
3002
3401
|
});
|
3003
3402
|
}
|
3004
3403
|
|
3404
|
+
/**
|
3405
|
+
* Adds an object to an array. If the array already includes the object this
|
3406
|
+
* method has no effect.
|
3407
|
+
*
|
3408
|
+
* @method addObject
|
3409
|
+
* @param {Array} array The array the passed item should be added to
|
3410
|
+
* @param {Object} item The item to add to the passed array
|
3411
|
+
*
|
3412
|
+
* @return 'undefined'
|
3413
|
+
*/
|
3005
3414
|
function addObject(array, item) {
|
3006
3415
|
var index = indexOf(array, item);
|
3007
3416
|
if (index === -1) {
|
@@ -3009,6 +3418,16 @@ enifed('ember-metal/enumerable_utils', ['exports', 'ember-metal/array'], functio
|
|
3009
3418
|
}
|
3010
3419
|
}
|
3011
3420
|
|
3421
|
+
/**
|
3422
|
+
* Removes an object from an array. If the array does not contain the passed
|
3423
|
+
* object this method has no effect.
|
3424
|
+
*
|
3425
|
+
* @method removeObject
|
3426
|
+
* @param {Array} array The array to remove the item from.
|
3427
|
+
* @param {Object} item The item to remove from the passed array.
|
3428
|
+
*
|
3429
|
+
* @return 'undefined'
|
3430
|
+
*/
|
3012
3431
|
function removeObject(array, item) {
|
3013
3432
|
var index = indexOf(array, item);
|
3014
3433
|
if (index !== -1) {
|
@@ -3042,6 +3461,31 @@ enifed('ember-metal/enumerable_utils', ['exports', 'ember-metal/array'], functio
|
|
3042
3461
|
return ret;
|
3043
3462
|
}
|
3044
3463
|
|
3464
|
+
/**
|
3465
|
+
* Replaces objects in an array with the passed objects.
|
3466
|
+
*
|
3467
|
+
* ```javascript
|
3468
|
+
* var array = [1,2,3];
|
3469
|
+
* Ember.EnumerableUtils.replace(array, 1, 2, [4, 5]); // [1, 4, 5]
|
3470
|
+
*
|
3471
|
+
* var array = [1,2,3];
|
3472
|
+
* Ember.EnumerableUtils.replace(array, 1, 1, [4, 5]); // [1, 4, 5, 3]
|
3473
|
+
*
|
3474
|
+
* var array = [1,2,3];
|
3475
|
+
* Ember.EnumerableUtils.replace(array, 10, 1, [4, 5]); // [1, 2, 3, 4, 5]
|
3476
|
+
* ```
|
3477
|
+
*
|
3478
|
+
* @method replace
|
3479
|
+
* @param {Array} array The array the objects should be inserted into.
|
3480
|
+
* @param {Number} idx Starting index in the array to replace. If *idx* >=
|
3481
|
+
* length, then append to the end of the array.
|
3482
|
+
* @param {Number} amt Number of elements that should be removed from the array,
|
3483
|
+
* starting at *idx*
|
3484
|
+
* @param {Array} objects An array of zero or more objects that should be
|
3485
|
+
* inserted into the array at *idx*
|
3486
|
+
*
|
3487
|
+
* @return {Array} The modified array.
|
3488
|
+
*/
|
3045
3489
|
function replace(array, idx, amt, objects) {
|
3046
3490
|
if (array.replace) {
|
3047
3491
|
return array.replace(idx, amt, objects);
|
@@ -3050,6 +3494,29 @@ enifed('ember-metal/enumerable_utils', ['exports', 'ember-metal/array'], functio
|
|
3050
3494
|
}
|
3051
3495
|
}
|
3052
3496
|
|
3497
|
+
/**
|
3498
|
+
* Calculates the intersection of two arrays. This method returns a new array
|
3499
|
+
* filled with the records that the two passed arrays share with each other.
|
3500
|
+
* If there is no intersection, an empty array will be returned.
|
3501
|
+
*
|
3502
|
+
* ```javascript
|
3503
|
+
* var array1 = [1, 2, 3, 4, 5];
|
3504
|
+
* var array2 = [1, 3, 5, 6, 7];
|
3505
|
+
*
|
3506
|
+
* Ember.EnumerableUtils.intersection(array1, array2); // [1, 3, 5]
|
3507
|
+
*
|
3508
|
+
* var array1 = [1, 2, 3];
|
3509
|
+
* var array2 = [4, 5, 6];
|
3510
|
+
*
|
3511
|
+
* Ember.EnumerableUtils.intersection(array1, array2); // []
|
3512
|
+
* ```
|
3513
|
+
*
|
3514
|
+
* @method intersection
|
3515
|
+
* @param {Array} array1 The first array
|
3516
|
+
* @param {Array} array2 The second array
|
3517
|
+
*
|
3518
|
+
* @return {Array} The intersection of the two passed arrays.
|
3519
|
+
*/
|
3053
3520
|
function intersection(array1, array2) {
|
3054
3521
|
var result = [];
|
3055
3522
|
forEach(array1, function (element) {
|
@@ -3252,6 +3719,17 @@ enifed('ember-metal/events', ['exports', 'ember-metal/core', 'ember-metal/utils'
|
|
3252
3719
|
return newActions;
|
3253
3720
|
}
|
3254
3721
|
|
3722
|
+
/**
|
3723
|
+
Add an event listener
|
3724
|
+
|
3725
|
+
@method addListener
|
3726
|
+
@for Ember
|
3727
|
+
@param obj
|
3728
|
+
@param {String} eventName
|
3729
|
+
@param {Object|Function} target A target object or a function
|
3730
|
+
@param {Function|String} method A function or the name of a function to be called on `target`
|
3731
|
+
@param {Boolean} once A flag whether a function should only be called once
|
3732
|
+
*/
|
3255
3733
|
function addListener(obj, eventName, target, method, once) {
|
3256
3734
|
Ember['default'].assert("You must pass at least an object and event name to Ember.addListener", !!obj && !!eventName);
|
3257
3735
|
|
@@ -3329,6 +3807,25 @@ enifed('ember-metal/events', ['exports', 'ember-metal/core', 'ember-metal/utils'
|
|
3329
3807
|
}
|
3330
3808
|
}
|
3331
3809
|
}
|
3810
|
+
|
3811
|
+
/**
|
3812
|
+
Suspend listener during callback.
|
3813
|
+
|
3814
|
+
This should only be used by the target of the event listener
|
3815
|
+
when it is taking an action that would cause the event, e.g.
|
3816
|
+
an object might suspend its property change listener while it is
|
3817
|
+
setting that property.
|
3818
|
+
|
3819
|
+
@method suspendListener
|
3820
|
+
@for Ember
|
3821
|
+
|
3822
|
+
@private
|
3823
|
+
@param obj
|
3824
|
+
@param {String} eventName
|
3825
|
+
@param {Object|Function} target A target object or a function
|
3826
|
+
@param {Function|String} method A function or the name of a function to be called on `target`
|
3827
|
+
@param {Function} callback
|
3828
|
+
*/
|
3332
3829
|
function suspendListener(obj, eventName, target, method, callback) {
|
3333
3830
|
if (!method && "function" === typeof target) {
|
3334
3831
|
method = target;
|
@@ -3354,6 +3851,19 @@ enifed('ember-metal/events', ['exports', 'ember-metal/core', 'ember-metal/utils'
|
|
3354
3851
|
return utils.tryFinally(tryable, finalizer);
|
3355
3852
|
}
|
3356
3853
|
|
3854
|
+
/**
|
3855
|
+
Suspends multiple listeners during a callback.
|
3856
|
+
|
3857
|
+
@method suspendListeners
|
3858
|
+
@for Ember
|
3859
|
+
|
3860
|
+
@private
|
3861
|
+
@param obj
|
3862
|
+
@param {Array} eventNames Array of event names
|
3863
|
+
@param {Object|Function} target A target object or a function
|
3864
|
+
@param {Function|String} method A function or the name of a function to be called on `target`
|
3865
|
+
@param {Function} callback
|
3866
|
+
*/
|
3357
3867
|
function suspendListeners(obj, eventNames, target, method, callback) {
|
3358
3868
|
if (!method && "function" === typeof target) {
|
3359
3869
|
method = target;
|
@@ -3390,6 +3900,14 @@ enifed('ember-metal/events', ['exports', 'ember-metal/core', 'ember-metal/utils'
|
|
3390
3900
|
return utils.tryFinally(tryable, finalizer);
|
3391
3901
|
}
|
3392
3902
|
|
3903
|
+
/**
|
3904
|
+
Return a list of currently watched events
|
3905
|
+
|
3906
|
+
@private
|
3907
|
+
@method watchedEvents
|
3908
|
+
@for Ember
|
3909
|
+
@param obj
|
3910
|
+
*/
|
3393
3911
|
function watchedEvents(obj) {
|
3394
3912
|
var listeners = obj["__ember_meta__"].listeners;
|
3395
3913
|
var ret = [];
|
@@ -3404,6 +3922,20 @@ enifed('ember-metal/events', ['exports', 'ember-metal/core', 'ember-metal/utils'
|
|
3404
3922
|
return ret;
|
3405
3923
|
}
|
3406
3924
|
|
3925
|
+
/**
|
3926
|
+
Send an event. The execution of suspended listeners
|
3927
|
+
is skipped, and once listeners are removed. A listener without
|
3928
|
+
a target is executed on the passed object. If an array of actions
|
3929
|
+
is not passed, the actions stored on the passed object are invoked.
|
3930
|
+
|
3931
|
+
@method sendEvent
|
3932
|
+
@for Ember
|
3933
|
+
@param obj
|
3934
|
+
@param {String} eventName
|
3935
|
+
@param {Array} params Optional parameters for each listener.
|
3936
|
+
@param {Array} actions Optional array of actions (listeners).
|
3937
|
+
@return true
|
3938
|
+
*/
|
3407
3939
|
function sendEvent(obj, eventName, params, actions) {
|
3408
3940
|
// first give object a chance to handle it
|
3409
3941
|
if (obj !== Ember['default'] && "function" === typeof obj.sendEvent) {
|
@@ -3454,6 +3986,13 @@ enifed('ember-metal/events', ['exports', 'ember-metal/core', 'ember-metal/utils'
|
|
3454
3986
|
return true;
|
3455
3987
|
}
|
3456
3988
|
|
3989
|
+
/**
|
3990
|
+
@private
|
3991
|
+
@method hasListeners
|
3992
|
+
@for Ember
|
3993
|
+
@param obj
|
3994
|
+
@param {String} eventName
|
3995
|
+
*/
|
3457
3996
|
function hasListeners(obj, eventName) {
|
3458
3997
|
var meta = obj["__ember_meta__"];
|
3459
3998
|
var actions = meta && meta.listeners && meta.listeners[eventName];
|
@@ -3461,6 +4000,13 @@ enifed('ember-metal/events', ['exports', 'ember-metal/core', 'ember-metal/utils'
|
|
3461
4000
|
return !!(actions && actions.length);
|
3462
4001
|
}
|
3463
4002
|
|
4003
|
+
/**
|
4004
|
+
@private
|
4005
|
+
@method listenersFor
|
4006
|
+
@for Ember
|
4007
|
+
@param obj
|
4008
|
+
@param {String} eventName
|
4009
|
+
*/
|
3464
4010
|
function listenersFor(obj, eventName) {
|
3465
4011
|
var ret = [];
|
3466
4012
|
var meta = obj["__ember_meta__"];
|
@@ -3479,6 +4025,29 @@ enifed('ember-metal/events', ['exports', 'ember-metal/core', 'ember-metal/utils'
|
|
3479
4025
|
return ret;
|
3480
4026
|
}
|
3481
4027
|
|
4028
|
+
/**
|
4029
|
+
Define a property as a function that should be executed when
|
4030
|
+
a specified event or events are triggered.
|
4031
|
+
|
4032
|
+
|
4033
|
+
``` javascript
|
4034
|
+
var Job = Ember.Object.extend({
|
4035
|
+
logCompleted: Ember.on('completed', function() {
|
4036
|
+
console.log('Job completed!');
|
4037
|
+
})
|
4038
|
+
});
|
4039
|
+
|
4040
|
+
var job = Job.create();
|
4041
|
+
|
4042
|
+
Ember.sendEvent(job, 'completed'); // Logs 'Job completed!'
|
4043
|
+
```
|
4044
|
+
|
4045
|
+
@method on
|
4046
|
+
@for Ember
|
4047
|
+
@param {String} eventNames*
|
4048
|
+
@param {Function} func
|
4049
|
+
@return func
|
4050
|
+
*/
|
3482
4051
|
function on() {
|
3483
4052
|
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
3484
4053
|
args[_key] = arguments[_key];
|
@@ -3496,6 +4065,9 @@ enifed('ember-metal/expand_properties', ['exports', 'ember-metal/error', 'ember-
|
|
3496
4065
|
'use strict';
|
3497
4066
|
|
3498
4067
|
|
4068
|
+
exports['default'] = expandProperties;
|
4069
|
+
|
4070
|
+
var SPLIT_REGEX = /\{|\}/;
|
3499
4071
|
|
3500
4072
|
/**
|
3501
4073
|
Expands `pattern`, invoking `callback` for each expansion.
|
@@ -3523,9 +4095,6 @@ enifed('ember-metal/expand_properties', ['exports', 'ember-metal/error', 'ember-
|
|
3523
4095
|
@param {Function} callback The callback to invoke. It is invoked once per
|
3524
4096
|
expansion, and is passed the expansion.
|
3525
4097
|
*/
|
3526
|
-
exports['default'] = expandProperties;
|
3527
|
-
|
3528
|
-
var SPLIT_REGEX = /\{|\}/;
|
3529
4098
|
function expandProperties(pattern, callback) {
|
3530
4099
|
if (pattern.indexOf(' ') > -1) {
|
3531
4100
|
throw new EmberError['default']('Brace expanded properties cannot contain spaces, e.g. \'user.{firstName, lastName}\' should be \'user.{firstName,lastName}\'');
|
@@ -3569,29 +4138,6 @@ enifed('ember-metal/get_properties', ['exports', 'ember-metal/property_get', 'em
|
|
3569
4138
|
'use strict';
|
3570
4139
|
|
3571
4140
|
|
3572
|
-
|
3573
|
-
/**
|
3574
|
-
To get multiple properties at once, call `Ember.getProperties`
|
3575
|
-
with an object followed by a list of strings or an array:
|
3576
|
-
|
3577
|
-
```javascript
|
3578
|
-
Ember.getProperties(record, 'firstName', 'lastName', 'zipCode');
|
3579
|
-
// { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
|
3580
|
-
```
|
3581
|
-
|
3582
|
-
is equivalent to:
|
3583
|
-
|
3584
|
-
```javascript
|
3585
|
-
Ember.getProperties(record, ['firstName', 'lastName', 'zipCode']);
|
3586
|
-
// { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
|
3587
|
-
```
|
3588
|
-
|
3589
|
-
@method getProperties
|
3590
|
-
@for Ember
|
3591
|
-
@param {Object} obj
|
3592
|
-
@param {String...|Array} list of keys to get
|
3593
|
-
@return {Object}
|
3594
|
-
*/
|
3595
4141
|
exports['default'] = getProperties;
|
3596
4142
|
function getProperties(obj) {
|
3597
4143
|
var ret = {};
|
@@ -3656,17 +4202,6 @@ enifed('ember-metal/instrumentation', ['exports', 'ember-metal/core', 'ember-met
|
|
3656
4202
|
exports.unsubscribe = unsubscribe;
|
3657
4203
|
exports.reset = reset;
|
3658
4204
|
|
3659
|
-
/**
|
3660
|
-
Notifies event's subscribers, calls `before` and `after` hooks.
|
3661
|
-
|
3662
|
-
@method instrument
|
3663
|
-
@namespace Ember.Instrumentation
|
3664
|
-
|
3665
|
-
@param {String} [name] Namespaced event name.
|
3666
|
-
@param {Object} payload
|
3667
|
-
@param {Function} callback Function that you're instrumenting.
|
3668
|
-
@param {Object} binding Context that instrument function is called with.
|
3669
|
-
*/
|
3670
4205
|
var subscribers = [];
|
3671
4206
|
var cache = {};
|
3672
4207
|
|
@@ -3693,6 +4228,18 @@ enifed('ember-metal/instrumentation', ['exports', 'ember-metal/core', 'ember-met
|
|
3693
4228
|
return +new Date();
|
3694
4229
|
};
|
3695
4230
|
})();
|
4231
|
+
|
4232
|
+
/**
|
4233
|
+
Notifies event's subscribers, calls `before` and `after` hooks.
|
4234
|
+
|
4235
|
+
@method instrument
|
4236
|
+
@namespace Ember.Instrumentation
|
4237
|
+
|
4238
|
+
@param {String} [name] Namespaced event name.
|
4239
|
+
@param {Object} payload
|
4240
|
+
@param {Function} callback Function that you're instrumenting.
|
4241
|
+
@param {Object} binding Context that instrument function is called with.
|
4242
|
+
*/
|
3696
4243
|
function instrument(name, _payload, callback, binding) {
|
3697
4244
|
if (arguments.length <= 3 && typeof _payload === "function") {
|
3698
4245
|
binding = callback;
|
@@ -3719,6 +4266,8 @@ enifed('ember-metal/instrumentation', ['exports', 'ember-metal/core', 'ember-met
|
|
3719
4266
|
}
|
3720
4267
|
}
|
3721
4268
|
|
4269
|
+
// private for now
|
4270
|
+
|
3722
4271
|
function _instrumentStart(name, _payload) {
|
3723
4272
|
var listeners = cache[name];
|
3724
4273
|
|
@@ -3762,6 +4311,17 @@ enifed('ember-metal/instrumentation', ['exports', 'ember-metal/core', 'ember-met
|
|
3762
4311
|
};
|
3763
4312
|
}
|
3764
4313
|
|
4314
|
+
/**
|
4315
|
+
Subscribes to a particular event or instrumented block of code.
|
4316
|
+
|
4317
|
+
@method subscribe
|
4318
|
+
@namespace Ember.Instrumentation
|
4319
|
+
|
4320
|
+
@param {String} [pattern] Namespaced event name.
|
4321
|
+
@param {Object} [object] Before and After hooks.
|
4322
|
+
|
4323
|
+
@return {Subscriber}
|
4324
|
+
*/
|
3765
4325
|
function subscribe(pattern, object) {
|
3766
4326
|
var paths = pattern.split(".");
|
3767
4327
|
var path;
|
@@ -3791,6 +4351,14 @@ enifed('ember-metal/instrumentation', ['exports', 'ember-metal/core', 'ember-met
|
|
3791
4351
|
return subscriber;
|
3792
4352
|
}
|
3793
4353
|
|
4354
|
+
/**
|
4355
|
+
Unsubscribes from a particular event or instrumented block of code.
|
4356
|
+
|
4357
|
+
@method unsubscribe
|
4358
|
+
@namespace Ember.Instrumentation
|
4359
|
+
|
4360
|
+
@param {Object} [subscriber]
|
4361
|
+
*/
|
3794
4362
|
function unsubscribe(subscriber) {
|
3795
4363
|
var index;
|
3796
4364
|
|
@@ -3804,6 +4372,12 @@ enifed('ember-metal/instrumentation', ['exports', 'ember-metal/core', 'ember-met
|
|
3804
4372
|
cache = {};
|
3805
4373
|
}
|
3806
4374
|
|
4375
|
+
/**
|
4376
|
+
Resets `Ember.Instrumentation` by flushing list of subscribers.
|
4377
|
+
|
4378
|
+
@method reset
|
4379
|
+
@namespace Ember.Instrumentation
|
4380
|
+
*/
|
3807
4381
|
function reset() {
|
3808
4382
|
subscribers.length = 0;
|
3809
4383
|
cache = {};
|
@@ -3817,30 +4391,6 @@ enifed('ember-metal/is_blank', ['exports', 'ember-metal/is_empty'], function (ex
|
|
3817
4391
|
'use strict';
|
3818
4392
|
|
3819
4393
|
|
3820
|
-
|
3821
|
-
/**
|
3822
|
-
A value is blank if it is empty or a whitespace string.
|
3823
|
-
|
3824
|
-
```javascript
|
3825
|
-
Ember.isBlank(); // true
|
3826
|
-
Ember.isBlank(null); // true
|
3827
|
-
Ember.isBlank(undefined); // true
|
3828
|
-
Ember.isBlank(''); // true
|
3829
|
-
Ember.isBlank([]); // true
|
3830
|
-
Ember.isBlank('\n\t'); // true
|
3831
|
-
Ember.isBlank(' '); // true
|
3832
|
-
Ember.isBlank({}); // false
|
3833
|
-
Ember.isBlank('\n\t Hello'); // false
|
3834
|
-
Ember.isBlank('Hello world'); // false
|
3835
|
-
Ember.isBlank([1,2,3]); // false
|
3836
|
-
```
|
3837
|
-
|
3838
|
-
@method isBlank
|
3839
|
-
@for Ember
|
3840
|
-
@param {Object} obj Value to test
|
3841
|
-
@return {Boolean}
|
3842
|
-
@since 1.5.0
|
3843
|
-
*/
|
3844
4394
|
exports['default'] = isBlank;
|
3845
4395
|
function isBlank(obj) {
|
3846
4396
|
return isEmpty['default'](obj) || typeof obj === 'string' && obj.match(/\S/) === null;
|
@@ -3922,30 +4472,6 @@ enifed('ember-metal/is_present', ['exports', 'ember-metal/is_blank'], function (
|
|
3922
4472
|
'use strict';
|
3923
4473
|
|
3924
4474
|
|
3925
|
-
|
3926
|
-
/**
|
3927
|
-
A value is present if it not `isBlank`.
|
3928
|
-
|
3929
|
-
```javascript
|
3930
|
-
Ember.isPresent(); // false
|
3931
|
-
Ember.isPresent(null); // false
|
3932
|
-
Ember.isPresent(undefined); // false
|
3933
|
-
Ember.isPresent(''); // false
|
3934
|
-
Ember.isPresent([]); // false
|
3935
|
-
Ember.isPresent('\n\t'); // false
|
3936
|
-
Ember.isPresent(' '); // false
|
3937
|
-
Ember.isPresent({}); // true
|
3938
|
-
Ember.isPresent('\n\t Hello'); // true
|
3939
|
-
Ember.isPresent('Hello world'); // true
|
3940
|
-
Ember.isPresent([1,2,3]); // true
|
3941
|
-
```
|
3942
|
-
|
3943
|
-
@method isPresent
|
3944
|
-
@for Ember
|
3945
|
-
@param {Object} obj Value to test
|
3946
|
-
@return {Boolean}
|
3947
|
-
@since 1.8.0
|
3948
|
-
*/
|
3949
4475
|
exports['default'] = isPresent;
|
3950
4476
|
function isPresent(obj) {
|
3951
4477
|
return !isBlank['default'](obj);
|
@@ -4714,23 +5240,6 @@ enifed('ember-metal/merge', ['exports', 'ember-metal/keys'], function (exports,
|
|
4714
5240
|
'use strict';
|
4715
5241
|
|
4716
5242
|
|
4717
|
-
|
4718
|
-
/**
|
4719
|
-
Merge the contents of two objects together into the first object.
|
4720
|
-
|
4721
|
-
```javascript
|
4722
|
-
Ember.merge({first: 'Tom'}, {last: 'Dale'}); // {first: 'Tom', last: 'Dale'}
|
4723
|
-
var a = {first: 'Yehuda'};
|
4724
|
-
var b = {last: 'Katz'};
|
4725
|
-
Ember.merge(a, b); // a == {first: 'Yehuda', last: 'Katz'}, b == {last: 'Katz'}
|
4726
|
-
```
|
4727
|
-
|
4728
|
-
@method merge
|
4729
|
-
@for Ember
|
4730
|
-
@param {Object} original The object to merge into
|
4731
|
-
@param {Object} updates The object to copy properties from
|
4732
|
-
@return {Object}
|
4733
|
-
*/
|
4734
5243
|
exports['default'] = merge;
|
4735
5244
|
function merge(original, updates) {
|
4736
5245
|
if (!updates || typeof updates !== 'object') {
|
@@ -4761,13 +5270,6 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/merge',
|
|
4761
5270
|
exports.beforeObserver = beforeObserver;
|
4762
5271
|
exports.Mixin = Mixin;
|
4763
5272
|
|
4764
|
-
/**
|
4765
|
-
@method mixin
|
4766
|
-
@for Ember
|
4767
|
-
@param obj
|
4768
|
-
@param mixins*
|
4769
|
-
@return obj
|
4770
|
-
*/
|
4771
5273
|
"REMOVE_USE_STRICT: true";var REQUIRED;
|
4772
5274
|
var a_slice = [].slice;
|
4773
5275
|
|
@@ -5219,6 +5721,14 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/merge',
|
|
5219
5721
|
|
5220
5722
|
return obj;
|
5221
5723
|
}
|
5724
|
+
|
5725
|
+
/**
|
5726
|
+
@method mixin
|
5727
|
+
@for Ember
|
5728
|
+
@param obj
|
5729
|
+
@param mixins*
|
5730
|
+
@return obj
|
5731
|
+
*/
|
5222
5732
|
function mixin(obj) {
|
5223
5733
|
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
5224
5734
|
args[_key - 1] = arguments[_key];
|
@@ -5494,6 +6004,13 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/merge',
|
|
5494
6004
|
REQUIRED.toString = function () {
|
5495
6005
|
return "(Required Property)";
|
5496
6006
|
};
|
6007
|
+
|
6008
|
+
/**
|
6009
|
+
Denotes a required property for a mixin
|
6010
|
+
|
6011
|
+
@method required
|
6012
|
+
@for Ember
|
6013
|
+
*/
|
5497
6014
|
function required() {
|
5498
6015
|
Ember['default'].deprecate("Ember.required is deprecated as its behavior is inconsistent and unreliable.", false);
|
5499
6016
|
return REQUIRED;
|
@@ -5505,10 +6022,59 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/merge',
|
|
5505
6022
|
}
|
5506
6023
|
|
5507
6024
|
Alias.prototype = new ember_metal__properties.Descriptor();
|
6025
|
+
|
6026
|
+
/**
|
6027
|
+
Makes a method available via an additional name.
|
6028
|
+
|
6029
|
+
```javascript
|
6030
|
+
App.Person = Ember.Object.extend({
|
6031
|
+
name: function() {
|
6032
|
+
return 'Tomhuda Katzdale';
|
6033
|
+
},
|
6034
|
+
moniker: Ember.aliasMethod('name')
|
6035
|
+
});
|
6036
|
+
|
6037
|
+
var goodGuy = App.Person.create();
|
6038
|
+
|
6039
|
+
goodGuy.name(); // 'Tomhuda Katzdale'
|
6040
|
+
goodGuy.moniker(); // 'Tomhuda Katzdale'
|
6041
|
+
```
|
6042
|
+
|
6043
|
+
@method aliasMethod
|
6044
|
+
@for Ember
|
6045
|
+
@param {String} methodName name of the method to alias
|
6046
|
+
*/
|
5508
6047
|
function aliasMethod(methodName) {
|
5509
6048
|
return new Alias(methodName);
|
5510
6049
|
}
|
5511
6050
|
|
6051
|
+
// ..........................................................
|
6052
|
+
// OBSERVER HELPER
|
6053
|
+
//
|
6054
|
+
|
6055
|
+
/**
|
6056
|
+
Specify a method that observes property changes.
|
6057
|
+
|
6058
|
+
```javascript
|
6059
|
+
Ember.Object.extend({
|
6060
|
+
valueObserver: Ember.observer('value', function() {
|
6061
|
+
// Executes whenever the "value" property changes
|
6062
|
+
})
|
6063
|
+
});
|
6064
|
+
```
|
6065
|
+
|
6066
|
+
In the future this method may become asynchronous. If you want to ensure
|
6067
|
+
synchronous behavior, use `immediateObserver`.
|
6068
|
+
|
6069
|
+
Also available as `Function.prototype.observes` if prototype extensions are
|
6070
|
+
enabled.
|
6071
|
+
|
6072
|
+
@method observer
|
6073
|
+
@for Ember
|
6074
|
+
@param {String} propertyNames*
|
6075
|
+
@param {Function} func
|
6076
|
+
@return func
|
6077
|
+
*/
|
5512
6078
|
function observer() {
|
5513
6079
|
for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
5514
6080
|
args[_key4] = arguments[_key4];
|
@@ -5543,6 +6109,29 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/merge',
|
|
5543
6109
|
return func;
|
5544
6110
|
}
|
5545
6111
|
|
6112
|
+
/**
|
6113
|
+
Specify a method that observes property changes.
|
6114
|
+
|
6115
|
+
```javascript
|
6116
|
+
Ember.Object.extend({
|
6117
|
+
valueObserver: Ember.immediateObserver('value', function() {
|
6118
|
+
// Executes whenever the "value" property changes
|
6119
|
+
})
|
6120
|
+
});
|
6121
|
+
```
|
6122
|
+
|
6123
|
+
In the future, `Ember.observer` may become asynchronous. In this event,
|
6124
|
+
`Ember.immediateObserver` will maintain the synchronous behavior.
|
6125
|
+
|
6126
|
+
Also available as `Function.prototype.observesImmediately` if prototype extensions are
|
6127
|
+
enabled.
|
6128
|
+
|
6129
|
+
@method immediateObserver
|
6130
|
+
@for Ember
|
6131
|
+
@param {String} propertyNames*
|
6132
|
+
@param {Function} func
|
6133
|
+
@return func
|
6134
|
+
*/
|
5546
6135
|
function immediateObserver() {
|
5547
6136
|
for (var i = 0, l = arguments.length; i < l; i++) {
|
5548
6137
|
var arg = arguments[i];
|
@@ -5552,6 +6141,48 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/merge',
|
|
5552
6141
|
return observer.apply(this, arguments);
|
5553
6142
|
}
|
5554
6143
|
|
6144
|
+
/**
|
6145
|
+
When observers fire, they are called with the arguments `obj`, `keyName`.
|
6146
|
+
|
6147
|
+
Note, `@each.property` observer is called per each add or replace of an element
|
6148
|
+
and it's not called with a specific enumeration item.
|
6149
|
+
|
6150
|
+
A `beforeObserver` fires before a property changes.
|
6151
|
+
|
6152
|
+
A `beforeObserver` is an alternative form of `.observesBefore()`.
|
6153
|
+
|
6154
|
+
```javascript
|
6155
|
+
App.PersonView = Ember.View.extend({
|
6156
|
+
friends: [{ name: 'Tom' }, { name: 'Stefan' }, { name: 'Kris' }],
|
6157
|
+
|
6158
|
+
valueWillChange: Ember.beforeObserver('content.value', function(obj, keyName) {
|
6159
|
+
this.changingFrom = obj.get(keyName);
|
6160
|
+
}),
|
6161
|
+
|
6162
|
+
valueDidChange: Ember.observer('content.value', function(obj, keyName) {
|
6163
|
+
// only run if updating a value already in the DOM
|
6164
|
+
if (this.get('state') === 'inDOM') {
|
6165
|
+
var color = obj.get(keyName) > this.changingFrom ? 'green' : 'red';
|
6166
|
+
// logic
|
6167
|
+
}
|
6168
|
+
}),
|
6169
|
+
|
6170
|
+
friendsDidChange: Ember.observer('friends.@each.name', function(obj, keyName) {
|
6171
|
+
// some logic
|
6172
|
+
// obj.get(keyName) returns friends array
|
6173
|
+
})
|
6174
|
+
});
|
6175
|
+
```
|
6176
|
+
|
6177
|
+
Also available as `Function.prototype.observesBefore` if prototype extensions are
|
6178
|
+
enabled.
|
6179
|
+
|
6180
|
+
@method beforeObserver
|
6181
|
+
@for Ember
|
6182
|
+
@param {String} propertyNames*
|
6183
|
+
@param {Function} func
|
6184
|
+
@return func
|
6185
|
+
*/
|
5555
6186
|
function beforeObserver() {
|
5556
6187
|
for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
5557
6188
|
args[_key5] = arguments[_key5];
|
@@ -5606,14 +6237,6 @@ enifed('ember-metal/observer', ['exports', 'ember-metal/watching', 'ember-metal/
|
|
5606
6237
|
exports.beforeObserversFor = beforeObserversFor;
|
5607
6238
|
exports.removeBeforeObserver = removeBeforeObserver;
|
5608
6239
|
|
5609
|
-
/**
|
5610
|
-
@method addObserver
|
5611
|
-
@for Ember
|
5612
|
-
@param obj
|
5613
|
-
@param {String} path
|
5614
|
-
@param {Object|Function} targetOrMethod
|
5615
|
-
@param {Function|String} [method]
|
5616
|
-
*/
|
5617
6240
|
var AFTER_OBSERVERS = ":change";
|
5618
6241
|
var BEFORE_OBSERVERS = ":before";
|
5619
6242
|
|
@@ -5624,6 +6247,15 @@ enifed('ember-metal/observer', ['exports', 'ember-metal/watching', 'ember-metal/
|
|
5624
6247
|
function beforeEvent(keyName) {
|
5625
6248
|
return keyName + BEFORE_OBSERVERS;
|
5626
6249
|
}
|
6250
|
+
|
6251
|
+
/**
|
6252
|
+
@method addObserver
|
6253
|
+
@for Ember
|
6254
|
+
@param obj
|
6255
|
+
@param {String} path
|
6256
|
+
@param {Object|Function} targetOrMethod
|
6257
|
+
@param {Function|String} [method]
|
6258
|
+
*/
|
5627
6259
|
function addObserver(obj, _path, target, method) {
|
5628
6260
|
ember_metal__events.addListener(obj, changeEvent(_path), target, method);
|
5629
6261
|
watching.watch(obj, _path);
|
@@ -5635,6 +6267,14 @@ enifed('ember-metal/observer', ['exports', 'ember-metal/watching', 'ember-metal/
|
|
5635
6267
|
return ember_metal__events.listenersFor(obj, changeEvent(path));
|
5636
6268
|
}
|
5637
6269
|
|
6270
|
+
/**
|
6271
|
+
@method removeObserver
|
6272
|
+
@for Ember
|
6273
|
+
@param obj
|
6274
|
+
@param {String} path
|
6275
|
+
@param {Object|Function} target
|
6276
|
+
@param {Function|String} [method]
|
6277
|
+
*/
|
5638
6278
|
function removeObserver(obj, path, target, method) {
|
5639
6279
|
watching.unwatch(obj, path);
|
5640
6280
|
ember_metal__events.removeListener(obj, changeEvent(path), target, method);
|
@@ -5642,6 +6282,14 @@ enifed('ember-metal/observer', ['exports', 'ember-metal/watching', 'ember-metal/
|
|
5642
6282
|
return this;
|
5643
6283
|
}
|
5644
6284
|
|
6285
|
+
/**
|
6286
|
+
@method addBeforeObserver
|
6287
|
+
@for Ember
|
6288
|
+
@param obj
|
6289
|
+
@param {String} path
|
6290
|
+
@param {Object|Function} target
|
6291
|
+
@param {Function|String} [method]
|
6292
|
+
*/
|
5645
6293
|
function addBeforeObserver(obj, path, target, method) {
|
5646
6294
|
ember_metal__events.addListener(obj, beforeEvent(path), target, method);
|
5647
6295
|
watching.watch(obj, path);
|
@@ -5649,6 +6297,11 @@ enifed('ember-metal/observer', ['exports', 'ember-metal/watching', 'ember-metal/
|
|
5649
6297
|
return this;
|
5650
6298
|
}
|
5651
6299
|
|
6300
|
+
// Suspend observer during callback.
|
6301
|
+
//
|
6302
|
+
// This should only be used by the target of the observer
|
6303
|
+
// while it is setting the observed path.
|
6304
|
+
|
5652
6305
|
function _suspendBeforeObserver(obj, path, target, method, callback) {
|
5653
6306
|
return ember_metal__events.suspendListener(obj, beforeEvent(path), target, method, callback);
|
5654
6307
|
}
|
@@ -5671,6 +6324,14 @@ enifed('ember-metal/observer', ['exports', 'ember-metal/watching', 'ember-metal/
|
|
5671
6324
|
return ember_metal__events.listenersFor(obj, beforeEvent(path));
|
5672
6325
|
}
|
5673
6326
|
|
6327
|
+
/**
|
6328
|
+
@method removeBeforeObserver
|
6329
|
+
@for Ember
|
6330
|
+
@param obj
|
6331
|
+
@param {String} path
|
6332
|
+
@param {Object|Function} target
|
6333
|
+
@param {Function|String} [method]
|
6334
|
+
*/
|
5674
6335
|
function removeBeforeObserver(obj, path, target, method) {
|
5675
6336
|
watching.unwatch(obj, path);
|
5676
6337
|
ember_metal__events.removeListener(obj, beforeEvent(path), target, method);
|
@@ -6089,18 +6750,14 @@ enifed('ember-metal/properties', ['exports', 'ember-metal/core', 'ember-metal/ut
|
|
6089
6750
|
exports.DEFAULT_GETTER_FUNCTION = DEFAULT_GETTER_FUNCTION;
|
6090
6751
|
exports.defineProperty = defineProperty;
|
6091
6752
|
|
6092
|
-
// ..........................................................
|
6093
|
-
// DESCRIPTOR
|
6094
|
-
//
|
6095
|
-
|
6096
|
-
/**
|
6097
|
-
Objects of this type can implement an interface to respond to requests to
|
6098
|
-
get and set. The default implementation handles simple properties.
|
6099
|
-
*/
|
6100
6753
|
function Descriptor() {
|
6101
6754
|
this.isDescriptor = true;
|
6102
6755
|
}
|
6103
6756
|
|
6757
|
+
// ..........................................................
|
6758
|
+
// DEFINING PROPERTIES API
|
6759
|
+
//
|
6760
|
+
|
6104
6761
|
function MANDATORY_SETTER_FUNCTION(name) {
|
6105
6762
|
return function SETTER_FUNCTION(value) {
|
6106
6763
|
Ember['default'].assert("You must use Ember.set() to set the `" + name + "` property (of " + this + ") to `" + value + "`.", false);
|
@@ -6114,6 +6771,51 @@ enifed('ember-metal/properties', ['exports', 'ember-metal/core', 'ember-metal/ut
|
|
6114
6771
|
};
|
6115
6772
|
}
|
6116
6773
|
|
6774
|
+
/**
|
6775
|
+
NOTE: This is a low-level method used by other parts of the API. You almost
|
6776
|
+
never want to call this method directly. Instead you should use
|
6777
|
+
`Ember.mixin()` to define new properties.
|
6778
|
+
|
6779
|
+
Defines a property on an object. This method works much like the ES5
|
6780
|
+
`Object.defineProperty()` method except that it can also accept computed
|
6781
|
+
properties and other special descriptors.
|
6782
|
+
|
6783
|
+
Normally this method takes only three parameters. However if you pass an
|
6784
|
+
instance of `Descriptor` as the third param then you can pass an
|
6785
|
+
optional value as the fourth parameter. This is often more efficient than
|
6786
|
+
creating new descriptor hashes for each property.
|
6787
|
+
|
6788
|
+
## Examples
|
6789
|
+
|
6790
|
+
```javascript
|
6791
|
+
// ES5 compatible mode
|
6792
|
+
Ember.defineProperty(contact, 'firstName', {
|
6793
|
+
writable: true,
|
6794
|
+
configurable: false,
|
6795
|
+
enumerable: true,
|
6796
|
+
value: 'Charles'
|
6797
|
+
});
|
6798
|
+
|
6799
|
+
// define a simple property
|
6800
|
+
Ember.defineProperty(contact, 'lastName', undefined, 'Jolley');
|
6801
|
+
|
6802
|
+
// define a computed property
|
6803
|
+
Ember.defineProperty(contact, 'fullName', Ember.computed(function() {
|
6804
|
+
return this.firstName+' '+this.lastName;
|
6805
|
+
}).property('firstName', 'lastName'));
|
6806
|
+
```
|
6807
|
+
|
6808
|
+
@private
|
6809
|
+
@method defineProperty
|
6810
|
+
@for Ember
|
6811
|
+
@param {Object} obj the object to define this property on. This may be a prototype.
|
6812
|
+
@param {String} keyName the name of the property
|
6813
|
+
@param {Descriptor} [desc] an instance of `Descriptor` (typically a
|
6814
|
+
computed property) or an ES5 descriptor.
|
6815
|
+
You must provide this or `data` but not both.
|
6816
|
+
@param {*} [data] something other than a descriptor, that will
|
6817
|
+
become the explicit value of this property.
|
6818
|
+
*/
|
6117
6819
|
function defineProperty(obj, keyName, desc, data, meta) {
|
6118
6820
|
var possibleDesc, existingDesc, watching, value;
|
6119
6821
|
|
@@ -6493,7 +7195,7 @@ enifed('ember-metal/property_events', ['exports', 'ember-metal/utils', 'ember-me
|
|
6493
7195
|
}
|
6494
7196
|
|
6495
7197
|
});
|
6496
|
-
enifed('ember-metal/property_get', ['exports', 'ember-metal/core', 'ember-metal/error', 'ember-metal/path_cache', 'ember-metal/platform/define_property'], function (exports, Ember, EmberError, path_cache, define_property) {
|
7198
|
+
enifed('ember-metal/property_get', ['exports', 'ember-metal/core', 'ember-metal/error', 'ember-metal/path_cache', 'ember-metal/platform/define_property', 'ember-metal/is_none'], function (exports, Ember, EmberError, path_cache, define_property, isNone) {
|
6497
7199
|
|
6498
7200
|
'use strict';
|
6499
7201
|
|
@@ -6502,6 +7204,8 @@ enifed('ember-metal/property_get', ['exports', 'ember-metal/core', 'ember-metal/
|
|
6502
7204
|
exports._getPath = _getPath;
|
6503
7205
|
exports.getWithDefault = getWithDefault;
|
6504
7206
|
|
7207
|
+
var FIRST_KEY = /^([^\.]+)/;
|
7208
|
+
|
6505
7209
|
// ..........................................................
|
6506
7210
|
// GET AND SET
|
6507
7211
|
//
|
@@ -6533,7 +7237,6 @@ enifed('ember-metal/property_get', ['exports', 'ember-metal/core', 'ember-metal/
|
|
6533
7237
|
@param {String} keyName The property key to retrieve
|
6534
7238
|
@return {Object} the property value or `null`.
|
6535
7239
|
*/
|
6536
|
-
var FIRST_KEY = /^([^\.]+)/;
|
6537
7240
|
function get(obj, keyName) {
|
6538
7241
|
// Helpers that operate with 'this' within an #each
|
6539
7242
|
if (keyName === "") {
|
@@ -6548,7 +7251,7 @@ enifed('ember-metal/property_get', ['exports', 'ember-metal/core', 'ember-metal/
|
|
6548
7251
|
Ember['default'].assert("Cannot call get with " + keyName + " key.", !!keyName);
|
6549
7252
|
Ember['default'].assert("Cannot call get with '" + keyName + "' on an undefined object.", obj !== undefined);
|
6550
7253
|
|
6551
|
-
if (
|
7254
|
+
if (isNone['default'](obj)) {
|
6552
7255
|
return _getPath(obj, keyName);
|
6553
7256
|
}
|
6554
7257
|
|
@@ -6579,6 +7282,19 @@ enifed('ember-metal/property_get', ['exports', 'ember-metal/core', 'ember-metal/
|
|
6579
7282
|
}
|
6580
7283
|
}
|
6581
7284
|
|
7285
|
+
/**
|
7286
|
+
Normalizes a target/path pair to reflect that actual target/path that should
|
7287
|
+
be observed, etc. This takes into account passing in global property
|
7288
|
+
paths (i.e. a path beginning with a capital letter not defined on the
|
7289
|
+
target).
|
7290
|
+
|
7291
|
+
@private
|
7292
|
+
@method normalizeTuple
|
7293
|
+
@for Ember
|
7294
|
+
@param {Object} target The current target. May be `null`.
|
7295
|
+
@param {String} path A path on the target or a global property path.
|
7296
|
+
@return {Array} a temporary array with the normalized target/path pair.
|
7297
|
+
*/
|
6582
7298
|
function normalizeTuple(target, path) {
|
6583
7299
|
var hasThis = path_cache.hasThis(path);
|
6584
7300
|
var isGlobal = !hasThis && path_cache.isGlobal(path);
|
@@ -6656,19 +7372,6 @@ enifed('ember-metal/property_set', ['exports', 'ember-metal/core', 'ember-metal/
|
|
6656
7372
|
exports.set = set;
|
6657
7373
|
exports.trySet = trySet;
|
6658
7374
|
|
6659
|
-
/**
|
6660
|
-
Sets the value of a property on an object, respecting computed properties
|
6661
|
-
and notifying observers and other listeners of the change. If the
|
6662
|
-
property is not defined but the object implements the `setUnknownProperty`
|
6663
|
-
method then that will be invoked as well.
|
6664
|
-
|
6665
|
-
@method set
|
6666
|
-
@for Ember
|
6667
|
-
@param {Object} obj The object to modify.
|
6668
|
-
@param {String} keyName The property key to set
|
6669
|
-
@param {Object} value The value to set
|
6670
|
-
@return {Object} the passed value.
|
6671
|
-
*/
|
6672
7375
|
function set(obj, keyName, value, tolerant) {
|
6673
7376
|
if (typeof obj === "string") {
|
6674
7377
|
Ember['default'].assert("Path '" + obj + "' must be global if no obj is given.", path_cache.isGlobalPath(obj));
|
@@ -6773,6 +7476,20 @@ enifed('ember-metal/property_set', ['exports', 'ember-metal/core', 'ember-metal/
|
|
6773
7476
|
|
6774
7477
|
return set(root, keyName, value);
|
6775
7478
|
}
|
7479
|
+
|
7480
|
+
/**
|
7481
|
+
Error-tolerant form of `Ember.set`. Will not blow up if any part of the
|
7482
|
+
chain is `undefined`, `null`, or destroyed.
|
7483
|
+
|
7484
|
+
This is primarily used when syncing bindings, which may try to update after
|
7485
|
+
an object has been destroyed.
|
7486
|
+
|
7487
|
+
@method trySet
|
7488
|
+
@for Ember
|
7489
|
+
@param {Object} obj The object to modify.
|
7490
|
+
@param {String} path The property path to set
|
7491
|
+
@param {Object} value The value to set
|
7492
|
+
*/
|
6776
7493
|
function trySet(root, path, value) {
|
6777
7494
|
return set(root, path, value, true);
|
6778
7495
|
}
|
@@ -7439,27 +8156,6 @@ enifed('ember-metal/set_properties', ['exports', 'ember-metal/property_events',
|
|
7439
8156
|
'use strict';
|
7440
8157
|
|
7441
8158
|
|
7442
|
-
|
7443
|
-
/**
|
7444
|
-
Set a list of properties on an object. These properties are set inside
|
7445
|
-
a single `beginPropertyChanges` and `endPropertyChanges` batch, so
|
7446
|
-
observers will be buffered.
|
7447
|
-
|
7448
|
-
```javascript
|
7449
|
-
var anObject = Ember.Object.create();
|
7450
|
-
|
7451
|
-
anObject.setProperties({
|
7452
|
-
firstName: 'Stanley',
|
7453
|
-
lastName: 'Stuart',
|
7454
|
-
age: 21
|
7455
|
-
});
|
7456
|
-
```
|
7457
|
-
|
7458
|
-
@method setProperties
|
7459
|
-
@param obj
|
7460
|
-
@param {Object} properties
|
7461
|
-
@return obj
|
7462
|
-
*/
|
7463
8159
|
exports['default'] = setProperties;
|
7464
8160
|
function setProperties(obj, properties) {
|
7465
8161
|
if (!properties || typeof properties !== "object") {
|
@@ -7881,31 +8577,55 @@ enifed('ember-metal/streams/utils', ['exports', './stream'], function (exports,
|
|
7881
8577
|
exports.concat = concat;
|
7882
8578
|
exports.chain = chain;
|
7883
8579
|
|
7884
|
-
/*
|
7885
|
-
Check whether an object is a stream or not
|
7886
|
-
|
7887
|
-
@public
|
7888
|
-
@for Ember.stream
|
7889
|
-
@function isStream
|
7890
|
-
@param {Object|Stream} object object to check whether it is a stream
|
7891
|
-
@return {Boolean} `true` if the object is a stream, `false` otherwise
|
7892
|
-
*/
|
7893
8580
|
function isStream(object) {
|
7894
8581
|
return object && object.isStream;
|
7895
8582
|
}
|
7896
8583
|
|
8584
|
+
/*
|
8585
|
+
A method of subscribing to a stream which is safe for use with a non-stream
|
8586
|
+
object. If a non-stream object is passed, the function does nothing.
|
8587
|
+
|
8588
|
+
@public
|
8589
|
+
@for Ember.stream
|
8590
|
+
@function subscribe
|
8591
|
+
@param {Object|Stream} object object or stream to potentially subscribe to
|
8592
|
+
@param {Function} callback function to run when stream value changes
|
8593
|
+
@param {Object} [context] the callback will be executed with this context if it
|
8594
|
+
is provided
|
8595
|
+
*/
|
7897
8596
|
function subscribe(object, callback, context) {
|
7898
8597
|
if (object && object.isStream) {
|
7899
8598
|
object.subscribe(callback, context);
|
7900
8599
|
}
|
7901
8600
|
}
|
7902
8601
|
|
8602
|
+
/*
|
8603
|
+
A method of unsubscribing from a stream which is safe for use with a non-stream
|
8604
|
+
object. If a non-stream object is passed, the function does nothing.
|
8605
|
+
|
8606
|
+
@public
|
8607
|
+
@for Ember.stream
|
8608
|
+
@function unsubscribe
|
8609
|
+
@param {Object|Stream} object object or stream to potentially unsubscribe from
|
8610
|
+
@param {Function} callback function originally passed to `subscribe()`
|
8611
|
+
@param {Object} [context] object originally passed to `subscribe()`
|
8612
|
+
*/
|
7903
8613
|
function unsubscribe(object, callback, context) {
|
7904
8614
|
if (object && object.isStream) {
|
7905
8615
|
object.unsubscribe(callback, context);
|
7906
8616
|
}
|
7907
8617
|
}
|
7908
8618
|
|
8619
|
+
/*
|
8620
|
+
Retrieve the value of a stream, or in the case a non-stream object is passed,
|
8621
|
+
return the object itself.
|
8622
|
+
|
8623
|
+
@public
|
8624
|
+
@for Ember.stream
|
8625
|
+
@function read
|
8626
|
+
@param {Object|Stream} object object to return the value of
|
8627
|
+
@return the stream's current value, or the non-stream object itself
|
8628
|
+
*/
|
7909
8629
|
function read(object) {
|
7910
8630
|
if (object && object.isStream) {
|
7911
8631
|
return object.value();
|
@@ -7914,6 +8634,18 @@ enifed('ember-metal/streams/utils', ['exports', './stream'], function (exports,
|
|
7914
8634
|
}
|
7915
8635
|
}
|
7916
8636
|
|
8637
|
+
/*
|
8638
|
+
Map an array, replacing any streams with their values.
|
8639
|
+
|
8640
|
+
@public
|
8641
|
+
@for Ember.stream
|
8642
|
+
@function readArray
|
8643
|
+
@param {Array} array The array to read values from
|
8644
|
+
@return {Array} a new array of the same length with the values of non-stream
|
8645
|
+
objects mapped from their original positions untouched, and
|
8646
|
+
the values of stream objects retaining their original position
|
8647
|
+
and replaced with the stream's current value.
|
8648
|
+
*/
|
7917
8649
|
function readArray(array) {
|
7918
8650
|
var length = array.length;
|
7919
8651
|
var ret = new Array(length);
|
@@ -7923,6 +8655,19 @@ enifed('ember-metal/streams/utils', ['exports', './stream'], function (exports,
|
|
7923
8655
|
return ret;
|
7924
8656
|
}
|
7925
8657
|
|
8658
|
+
/*
|
8659
|
+
Map a hash, replacing any stream property values with the current value of that
|
8660
|
+
stream.
|
8661
|
+
|
8662
|
+
@public
|
8663
|
+
@for Ember.stream
|
8664
|
+
@function readHash
|
8665
|
+
@param {Object} object The hash to read keys and values from
|
8666
|
+
@return {Object} a new object with the same keys as the passed object. The
|
8667
|
+
property values in the new object are the original values in
|
8668
|
+
the case of non-stream objects, and the streams' current
|
8669
|
+
values in the case of stream objects.
|
8670
|
+
*/
|
7926
8671
|
function readHash(object) {
|
7927
8672
|
var ret = {};
|
7928
8673
|
for (var key in object) {
|
@@ -7931,6 +8676,16 @@ enifed('ember-metal/streams/utils', ['exports', './stream'], function (exports,
|
|
7931
8676
|
return ret;
|
7932
8677
|
}
|
7933
8678
|
|
8679
|
+
/*
|
8680
|
+
Check whether an array contains any stream values
|
8681
|
+
|
8682
|
+
@public
|
8683
|
+
@for Ember.stream
|
8684
|
+
@function scanArray
|
8685
|
+
@param {Array} array array given to a handlebars helper
|
8686
|
+
@return {Boolean} `true` if the array contains a stream/bound value, `false`
|
8687
|
+
otherwise
|
8688
|
+
*/
|
7934
8689
|
function scanArray(array) {
|
7935
8690
|
var length = array.length;
|
7936
8691
|
var containsStream = false;
|
@@ -7945,6 +8700,16 @@ enifed('ember-metal/streams/utils', ['exports', './stream'], function (exports,
|
|
7945
8700
|
return containsStream;
|
7946
8701
|
}
|
7947
8702
|
|
8703
|
+
/*
|
8704
|
+
Check whether a hash has any stream property values
|
8705
|
+
|
8706
|
+
@public
|
8707
|
+
@for Ember.stream
|
8708
|
+
@function scanHash
|
8709
|
+
@param {Object} hash "hash" argument given to a handlebars helper
|
8710
|
+
@return {Boolean} `true` if the object contains a stream/bound value, `false`
|
8711
|
+
otherwise
|
8712
|
+
*/
|
7948
8713
|
function scanHash(hash) {
|
7949
8714
|
var containsStream = false;
|
7950
8715
|
|
@@ -7958,6 +8723,19 @@ enifed('ember-metal/streams/utils', ['exports', './stream'], function (exports,
|
|
7958
8723
|
return containsStream;
|
7959
8724
|
}
|
7960
8725
|
|
8726
|
+
/*
|
8727
|
+
Join an array, with any streams replaced by their current values
|
8728
|
+
|
8729
|
+
@public
|
8730
|
+
@for Ember.stream
|
8731
|
+
@function concat
|
8732
|
+
@param {Array} array An array containing zero or more stream objects and
|
8733
|
+
zero or more non-stream objects
|
8734
|
+
@param {String} separator string to be used to join array elements
|
8735
|
+
@return {String} String with array elements concatenated and joined by the
|
8736
|
+
provided separator, and any stream array members having been
|
8737
|
+
replaced by the current value of the stream
|
8738
|
+
*/
|
7961
8739
|
function concat(array, separator) {
|
7962
8740
|
// TODO: Create subclass ConcatStream < Stream. Defer
|
7963
8741
|
// subscribing to streams until the value() is called.
|
@@ -7978,6 +8756,38 @@ enifed('ember-metal/streams/utils', ['exports', './stream'], function (exports,
|
|
7978
8756
|
}
|
7979
8757
|
}
|
7980
8758
|
|
8759
|
+
/*
|
8760
|
+
Generate a new stream by providing a source stream and a function that can
|
8761
|
+
be used to transform the stream's value. In the case of a non-stream object,
|
8762
|
+
returns the result of the function.
|
8763
|
+
|
8764
|
+
The value to transform would typically be available to the function you pass
|
8765
|
+
to `chain()` via scope. For example:
|
8766
|
+
|
8767
|
+
```javascript
|
8768
|
+
var source = ...; // stream returning a number
|
8769
|
+
// or a numeric (non-stream) object
|
8770
|
+
var result = chain(source, function() {
|
8771
|
+
var currentValue = read(source);
|
8772
|
+
return currentValue + 1;
|
8773
|
+
});
|
8774
|
+
```
|
8775
|
+
|
8776
|
+
In the example, result is a stream if source is a stream, or a number of
|
8777
|
+
source was numeric.
|
8778
|
+
|
8779
|
+
@public
|
8780
|
+
@for Ember.stream
|
8781
|
+
@function chain
|
8782
|
+
@param {Object|Stream} value A stream or non-stream object
|
8783
|
+
@param {Function} fn function to be run when the stream value changes, or to
|
8784
|
+
be run once in the case of a non-stream object
|
8785
|
+
@return {Object|Stream} In the case of a stream `value` parameter, a new
|
8786
|
+
stream that will be updated with the return value of
|
8787
|
+
the provided function `fn`. In the case of a
|
8788
|
+
non-stream object, the return value of the provided
|
8789
|
+
function `fn`.
|
8790
|
+
*/
|
7981
8791
|
function chain(value, fn) {
|
7982
8792
|
if (isStream(value)) {
|
7983
8793
|
var stream = new Stream['default'](fn);
|
@@ -8009,15 +8819,6 @@ enifed('ember-metal/utils', ['exports', 'ember-metal/core', 'ember-metal/platfor
|
|
8009
8819
|
exports.isArray = isArray;
|
8010
8820
|
exports.canInvoke = canInvoke;
|
8011
8821
|
|
8012
|
-
/**
|
8013
|
-
Generates a universally unique identifier. This method
|
8014
|
-
is used internally by Ember for assisting with
|
8015
|
-
the generation of GUID's and other unique identifiers
|
8016
|
-
such as `bind-attr` data attributes.
|
8017
|
-
|
8018
|
-
@public
|
8019
|
-
@return {Number} [description]
|
8020
|
-
*/
|
8021
8822
|
"REMOVE_USE_STRICT: true"; /**
|
8022
8823
|
@module ember-metal
|
8023
8824
|
*/
|
@@ -8030,6 +8831,16 @@ enifed('ember-metal/utils', ['exports', 'ember-metal/core', 'ember-metal/platfor
|
|
8030
8831
|
@return {Number} the uuid
|
8031
8832
|
*/
|
8032
8833
|
var _uuid = 0;
|
8834
|
+
|
8835
|
+
/**
|
8836
|
+
Generates a universally unique identifier. This method
|
8837
|
+
is used internally by Ember for assisting with
|
8838
|
+
the generation of GUID's and other unique identifiers
|
8839
|
+
such as `bind-attr` data attributes.
|
8840
|
+
|
8841
|
+
@public
|
8842
|
+
@return {Number} [description]
|
8843
|
+
*/
|
8033
8844
|
function uuid() {
|
8034
8845
|
return ++_uuid;
|
8035
8846
|
}
|
@@ -8155,7 +8966,9 @@ enifed('ember-metal/utils', ['exports', 'ember-metal/core', 'ember-metal/platfor
|
|
8155
8966
|
var NEXT_SUPER_PROPERTY = {
|
8156
8967
|
name: "__nextSuper",
|
8157
8968
|
descriptor: undefinedDescriptor
|
8158
|
-
};
|
8969
|
+
};
|
8970
|
+
|
8971
|
+
function generateGuid(obj, prefix) {
|
8159
8972
|
if (!prefix) {
|
8160
8973
|
prefix = GUID_PREFIX;
|
8161
8974
|
}
|
@@ -8176,6 +8989,20 @@ enifed('ember-metal/utils', ['exports', 'ember-metal/core', 'ember-metal/platfor
|
|
8176
8989
|
return ret;
|
8177
8990
|
}
|
8178
8991
|
|
8992
|
+
/**
|
8993
|
+
Returns a unique id for the object. If the object does not yet have a guid,
|
8994
|
+
one will be assigned to it. You can call this on any object,
|
8995
|
+
`Ember.Object`-based or not, but be aware that it will add a `_guid`
|
8996
|
+
property.
|
8997
|
+
|
8998
|
+
You can also use this method on DOM Element objects.
|
8999
|
+
|
9000
|
+
@private
|
9001
|
+
@method guidFor
|
9002
|
+
@for Ember
|
9003
|
+
@param {Object} obj any object, string, number, Element, or primitive
|
9004
|
+
@return {String} the unique guid for this instance.
|
9005
|
+
*/
|
8179
9006
|
function guidFor(obj) {
|
8180
9007
|
|
8181
9008
|
// special cases where we don't want to add a key to object
|
@@ -8361,6 +9188,39 @@ enifed('ember-metal/utils', ['exports', 'ember-metal/core', 'ember-metal/platfor
|
|
8361
9188
|
return value;
|
8362
9189
|
}
|
8363
9190
|
|
9191
|
+
/**
|
9192
|
+
@deprecated
|
9193
|
+
@private
|
9194
|
+
|
9195
|
+
In order to store defaults for a class, a prototype may need to create
|
9196
|
+
a default meta object, which will be inherited by any objects instantiated
|
9197
|
+
from the class's constructor.
|
9198
|
+
|
9199
|
+
However, the properties of that meta object are only shallow-cloned,
|
9200
|
+
so if a property is a hash (like the event system's `listeners` hash),
|
9201
|
+
it will by default be shared across all instances of that class.
|
9202
|
+
|
9203
|
+
This method allows extensions to deeply clone a series of nested hashes or
|
9204
|
+
other complex objects. For instance, the event system might pass
|
9205
|
+
`['listeners', 'foo:change', 'ember157']` to `prepareMetaPath`, which will
|
9206
|
+
walk down the keys provided.
|
9207
|
+
|
9208
|
+
For each key, if the key does not exist, it is created. If it already
|
9209
|
+
exists and it was inherited from its constructor, the constructor's
|
9210
|
+
key is cloned.
|
9211
|
+
|
9212
|
+
You can also pass false for `writable`, which will simply return
|
9213
|
+
undefined if `prepareMetaPath` discovers any part of the path that
|
9214
|
+
shared or undefined.
|
9215
|
+
|
9216
|
+
@method metaPath
|
9217
|
+
@for Ember
|
9218
|
+
@param {Object} obj The object whose meta we are examining
|
9219
|
+
@param {Array} path An array of keys to walk down
|
9220
|
+
@param {Boolean} writable whether or not to create a new meta
|
9221
|
+
(or meta property) if one does not already exist or if it's
|
9222
|
+
shared with its constructor
|
9223
|
+
*/
|
8364
9224
|
function metaPath(obj, path, writable) {
|
8365
9225
|
Ember['default'].deprecate("Ember.metaPath is deprecated and will be removed from future releases.");
|
8366
9226
|
var _meta = meta(obj, writable);
|
@@ -8389,6 +9249,18 @@ enifed('ember-metal/utils', ['exports', 'ember-metal/core', 'ember-metal/platfor
|
|
8389
9249
|
return value;
|
8390
9250
|
}
|
8391
9251
|
|
9252
|
+
/**
|
9253
|
+
Wraps the passed function so that `this._super` will point to the superFunc
|
9254
|
+
when the function is invoked. This is the primitive we use to implement
|
9255
|
+
calls to super.
|
9256
|
+
|
9257
|
+
@private
|
9258
|
+
@method wrap
|
9259
|
+
@for Ember
|
9260
|
+
@param {Function} func The function to call
|
9261
|
+
@param {Function} superFunc The super function.
|
9262
|
+
@return {Function} wrapped function.
|
9263
|
+
*/
|
8392
9264
|
function wrap(func, superFunc) {
|
8393
9265
|
function superWrapper() {
|
8394
9266
|
var ret;
|
@@ -8483,6 +9355,29 @@ enifed('ember-metal/utils', ['exports', 'ember-metal/core', 'ember-metal/platfor
|
|
8483
9355
|
}
|
8484
9356
|
return false;
|
8485
9357
|
}
|
9358
|
+
|
9359
|
+
/**
|
9360
|
+
Forces the passed object to be part of an array. If the object is already
|
9361
|
+
an array or array-like, it will return the object. Otherwise, it will add the object to
|
9362
|
+
an array. If obj is `null` or `undefined`, it will return an empty array.
|
9363
|
+
|
9364
|
+
```javascript
|
9365
|
+
Ember.makeArray(); // []
|
9366
|
+
Ember.makeArray(null); // []
|
9367
|
+
Ember.makeArray(undefined); // []
|
9368
|
+
Ember.makeArray('lindsay'); // ['lindsay']
|
9369
|
+
Ember.makeArray([1, 2, 42]); // [1, 2, 42]
|
9370
|
+
|
9371
|
+
var controller = Ember.ArrayProxy.create({ content: [] });
|
9372
|
+
|
9373
|
+
Ember.makeArray(controller) === controller; // true
|
9374
|
+
```
|
9375
|
+
|
9376
|
+
@method makeArray
|
9377
|
+
@for Ember
|
9378
|
+
@param {Object} obj the object
|
9379
|
+
@return {Array}
|
9380
|
+
*/
|
8486
9381
|
function makeArray(obj) {
|
8487
9382
|
if (obj === null || obj === undefined) {
|
8488
9383
|
return [];
|
@@ -8510,6 +9405,26 @@ enifed('ember-metal/utils', ['exports', 'ember-metal/core', 'ember-metal/platfor
|
|
8510
9405
|
function canInvoke(obj, methodName) {
|
8511
9406
|
return !!(obj && typeof obj[methodName] === "function");
|
8512
9407
|
}
|
9408
|
+
|
9409
|
+
/**
|
9410
|
+
Checks to see if the `methodName` exists on the `obj`,
|
9411
|
+
and if it does, invokes it with the arguments passed.
|
9412
|
+
|
9413
|
+
```javascript
|
9414
|
+
var d = new Date('03/15/2013');
|
9415
|
+
|
9416
|
+
Ember.tryInvoke(d, 'getTime'); // 1363320000000
|
9417
|
+
Ember.tryInvoke(d, 'setFullYear', [2014]); // 1394856000000
|
9418
|
+
Ember.tryInvoke(d, 'noSuchMethod', [2014]); // undefined
|
9419
|
+
```
|
9420
|
+
|
9421
|
+
@method tryInvoke
|
9422
|
+
@for Ember
|
9423
|
+
@param {Object} obj The object to check for the method
|
9424
|
+
@param {String} methodName The method name to check for
|
9425
|
+
@param {Array} [args] The arguments to pass to the method
|
9426
|
+
@return {*} the return value of the invoked method or undefined if it cannot be invoked
|
9427
|
+
*/
|
8513
9428
|
function tryInvoke(obj, methodName, args) {
|
8514
9429
|
if (canInvoke(obj, methodName)) {
|
8515
9430
|
return args ? applyStr(obj, methodName, args) : applyStr(obj, methodName);
|
@@ -8786,6 +9701,20 @@ enifed('ember-metal/utils', ['exports', 'ember-metal/core', 'ember-metal/platfor
|
|
8786
9701
|
|
8787
9702
|
return ret;
|
8788
9703
|
}
|
9704
|
+
|
9705
|
+
/**
|
9706
|
+
Convenience method to inspect an object. This method will attempt to
|
9707
|
+
convert the object into a useful string description.
|
9708
|
+
|
9709
|
+
It is a pretty simple implementation. If you want something more robust,
|
9710
|
+
use something like JSDump: https://github.com/NV/jsDump
|
9711
|
+
|
9712
|
+
@method inspect
|
9713
|
+
@for Ember
|
9714
|
+
@param {Object} obj The object you want to inspect.
|
9715
|
+
@return {String} A description of the object
|
9716
|
+
@since 1.4.0
|
9717
|
+
*/
|
8789
9718
|
function inspect(obj) {
|
8790
9719
|
var type = typeOf(obj);
|
8791
9720
|
if (type === "array") {
|
@@ -8817,6 +9746,13 @@ enifed('ember-metal/utils', ['exports', 'ember-metal/core', 'ember-metal/platfor
|
|
8817
9746
|
return "{" + ret.join(", ") + "}";
|
8818
9747
|
}
|
8819
9748
|
|
9749
|
+
// The following functions are intentionally minified to keep the functions
|
9750
|
+
// below Chrome's function body size inlining limit of 600 chars.
|
9751
|
+
/**
|
9752
|
+
@param {Object} target
|
9753
|
+
@param {Function} method
|
9754
|
+
@param {Array} args
|
9755
|
+
*/
|
8820
9756
|
function apply(t, m, a) {
|
8821
9757
|
var l = a && a.length;
|
8822
9758
|
if (!a || !l) {
|
@@ -8838,6 +9774,11 @@ enifed('ember-metal/utils', ['exports', 'ember-metal/core', 'ember-metal/platfor
|
|
8838
9774
|
}
|
8839
9775
|
}
|
8840
9776
|
|
9777
|
+
/**
|
9778
|
+
@param {Object} target
|
9779
|
+
@param {String} method
|
9780
|
+
@param {Array} args
|
9781
|
+
*/
|
8841
9782
|
function applyStr(t, m, a) {
|
8842
9783
|
var l = a && a.length;
|
8843
9784
|
if (!a || !l) {
|
@@ -8940,7 +9881,8 @@ enifed('ember-metal/watch_key', ['exports', 'ember-metal/core', 'ember-metal/uti
|
|
8940
9881
|
|
8941
9882
|
// This is super annoying, but required until
|
8942
9883
|
// https://github.com/babel/babel/issues/906 is resolved
|
8943
|
-
;
|
9884
|
+
; // jshint ignore:line
|
9885
|
+
|
8944
9886
|
function unwatchKey(obj, keyName, meta) {
|
8945
9887
|
var m = meta || utils.meta(obj);
|
8946
9888
|
var watching = m.watching;
|
@@ -9073,6 +10015,16 @@ enifed('ember-metal/watching', ['exports', 'ember-metal/utils', 'ember-metal/cha
|
|
9073
10015
|
}
|
9074
10016
|
|
9075
10017
|
var NODE_STACK = [];
|
10018
|
+
|
10019
|
+
/**
|
10020
|
+
Tears down the meta on an object so that it can be garbage collected.
|
10021
|
+
Multiple calls will have no effect.
|
10022
|
+
|
10023
|
+
@method destroy
|
10024
|
+
@for Ember
|
10025
|
+
@param {Object} obj the object to destroy
|
10026
|
+
@return {void}
|
10027
|
+
*/
|
9076
10028
|
function destroy(obj) {
|
9077
10029
|
var meta = obj["__ember_meta__"];
|
9078
10030
|
var node, nodes, key, nodeObject;
|
@@ -9168,15 +10120,16 @@ enifed('ember-template-compiler/plugins', ['exports'], function (exports) {
|
|
9168
10120
|
|
9169
10121
|
exports.registerPlugin = registerPlugin;
|
9170
10122
|
|
10123
|
+
var plugins = {
|
10124
|
+
ast: []
|
10125
|
+
};
|
10126
|
+
|
9171
10127
|
/**
|
9172
10128
|
Adds an AST plugin to be used by Ember.HTMLBars.compile.
|
9173
10129
|
|
9174
10130
|
@private
|
9175
10131
|
@method registerASTPlugin
|
9176
10132
|
*/
|
9177
|
-
var plugins = {
|
9178
|
-
ast: []
|
9179
|
-
};
|
9180
10133
|
function registerPlugin(type, Plugin) {
|
9181
10134
|
if (!plugins[type]) {
|
9182
10135
|
throw new Error('Attempting to register "' + Plugin + '" as "' + type + '" which is not a valid HTMLBars plugin type.');
|
@@ -9378,7 +10331,7 @@ enifed('ember-template-compiler/system/compile_options', ['exports', 'ember-meta
|
|
9378
10331
|
options = {};
|
9379
10332
|
}
|
9380
10333
|
|
9381
|
-
options.revision = "Ember@1.12.
|
10334
|
+
options.revision = "Ember@1.12.1";
|
9382
10335
|
options.disableComponentGeneration = disableComponentGeneration;
|
9383
10336
|
options.plugins = plugins['default'];
|
9384
10337
|
|