ember-source 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/dist/ember-runtime.js +124 -41
- data/dist/ember-template-compiler.js +97 -12
- data/dist/ember-testing.js +1 -1
- data/dist/ember.debug.js +151 -51
- data/dist/ember.js +151 -51
- data/dist/ember.min.js +12 -12
- data/dist/ember.prod.js +149 -48
- 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: 9cc64c5dd2c8c7843ab6d7d8b26cf818d499752c
|
4
|
+
data.tar.gz: 50db81852adbd9ad364dc2d644de0feae27f67c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 302cd2eceb635088d49d7154886a0e851a3b4de8acc936e712cd950756d6a86909602803eb3cc0574a1bac2949716fbee1a80eb37b7b55d63ce63ce3c3ce558d
|
7
|
+
data.tar.gz: cb3314d8d16dba6c167d827dde4aeae20503024b2c039e5d9faf069dc459777f9269f0355a874af34f0d664d461fffcd79f62c2d71bad6d57c379e9706ce71b9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.1
|
data/dist/ember-runtime.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
7
7
|
* @license Licensed under MIT license
|
8
8
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
9
|
-
* @version 2.3.
|
9
|
+
* @version 2.3.1
|
10
10
|
*/
|
11
11
|
|
12
12
|
var enifed, requireModule, require, requirejs, Ember;
|
@@ -3690,7 +3690,6 @@ enifed('ember-metal/computed', ['exports', 'ember-metal/debug', 'ember-metal/pro
|
|
3690
3690
|
var args;
|
3691
3691
|
|
3692
3692
|
var addArg = function (property) {
|
3693
|
-
_emberMetalDebug.assert('Depending on arrays using a dependent key ending with `@each` is no longer supported. ' + ('Please refactor from `Ember.computed(\'' + property + '\', function() {});` to `Ember.computed(\'' + property.slice(0, -6) + '.[]\', function() {})`.'), property.slice(-5) !== '@each');
|
3694
3693
|
args.push(property);
|
3695
3694
|
};
|
3696
3695
|
|
@@ -4794,7 +4793,7 @@ enifed('ember-metal/core', ['exports'], function (exports) {
|
|
4794
4793
|
|
4795
4794
|
@class Ember
|
4796
4795
|
@static
|
4797
|
-
@version 2.3.
|
4796
|
+
@version 2.3.1
|
4798
4797
|
@public
|
4799
4798
|
*/
|
4800
4799
|
|
@@ -4838,11 +4837,11 @@ enifed('ember-metal/core', ['exports'], function (exports) {
|
|
4838
4837
|
|
4839
4838
|
@property VERSION
|
4840
4839
|
@type String
|
4841
|
-
@default '2.3.
|
4840
|
+
@default '2.3.1'
|
4842
4841
|
@static
|
4843
4842
|
@public
|
4844
4843
|
*/
|
4845
|
-
Ember.VERSION = '2.3.
|
4844
|
+
Ember.VERSION = '2.3.1';
|
4846
4845
|
|
4847
4846
|
/**
|
4848
4847
|
The hash of environment variables used to control various configuration
|
@@ -5579,6 +5578,8 @@ enifed('ember-metal/expand_properties', ['exports', 'ember-metal/error'], functi
|
|
5579
5578
|
|
5580
5579
|
var SPLIT_REGEX = /\{|\}/;
|
5581
5580
|
|
5581
|
+
var END_WITH_EACH_REGEX = /\.@each$/;
|
5582
|
+
|
5582
5583
|
/**
|
5583
5584
|
Expands `pattern`, invoking `callback` for each expansion.
|
5584
5585
|
|
@@ -5623,10 +5624,10 @@ enifed('ember-metal/expand_properties', ['exports', 'ember-metal/error'], functi
|
|
5623
5624
|
});
|
5624
5625
|
|
5625
5626
|
properties.forEach(function (property) {
|
5626
|
-
callback(property.join(''));
|
5627
|
+
callback(property.join('').replace(END_WITH_EACH_REGEX, '.[]'));
|
5627
5628
|
});
|
5628
5629
|
} else {
|
5629
|
-
callback(pattern);
|
5630
|
+
callback(pattern.replace(END_WITH_EACH_REGEX, '.[]'));
|
5630
5631
|
}
|
5631
5632
|
}
|
5632
5633
|
|
@@ -7514,6 +7515,7 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/error',
|
|
7514
7515
|
exports.aliasMethod = aliasMethod;
|
7515
7516
|
exports.observer = observer;
|
7516
7517
|
exports._immediateObserver = _immediateObserver;
|
7518
|
+
exports._beforeObserver = _beforeObserver;
|
7517
7519
|
|
7518
7520
|
function ROOT() {}
|
7519
7521
|
ROOT.__hasSuper = false;
|
@@ -7837,11 +7839,13 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/error',
|
|
7837
7839
|
var prev = obj[key];
|
7838
7840
|
|
7839
7841
|
if ('function' === typeof prev) {
|
7842
|
+
updateObserversAndListeners(obj, key, prev, '__ember_observesBefore__', _emberMetalObserver._removeBeforeObserver);
|
7840
7843
|
updateObserversAndListeners(obj, key, prev, '__ember_observes__', _emberMetalObserver.removeObserver);
|
7841
7844
|
updateObserversAndListeners(obj, key, prev, '__ember_listens__', _emberMetalEvents.removeListener);
|
7842
7845
|
}
|
7843
7846
|
|
7844
7847
|
if ('function' === typeof observerOrListener) {
|
7848
|
+
updateObserversAndListeners(obj, key, observerOrListener, '__ember_observesBefore__', _emberMetalObserver._addBeforeObserver);
|
7845
7849
|
updateObserversAndListeners(obj, key, observerOrListener, '__ember_observes__', _emberMetalObserver.addObserver);
|
7846
7850
|
updateObserversAndListeners(obj, key, observerOrListener, '__ember_listens__', _emberMetalEvents.addListener);
|
7847
7851
|
}
|
@@ -8280,8 +8284,6 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/error',
|
|
8280
8284
|
var paths;
|
8281
8285
|
|
8282
8286
|
var addWatchedProperty = function (path) {
|
8283
|
-
_emberMetalDebug.assert('Depending on arrays using a dependent key ending with `@each` is no longer supported. ' + ('Please refactor from `Ember.observer(\'' + path + '\', function() {});` to `Ember.observer(\'' + path.slice(0, -6) + '.[]\', function() {})`.'), path.slice(-5) !== '@each');
|
8284
|
-
|
8285
8287
|
paths.push(path);
|
8286
8288
|
};
|
8287
8289
|
var _paths = args.slice(0, -1);
|
@@ -8345,6 +8347,82 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/error',
|
|
8345
8347
|
return observer.apply(this, arguments);
|
8346
8348
|
}
|
8347
8349
|
|
8350
|
+
/**
|
8351
|
+
When observers fire, they are called with the arguments `obj`, `keyName`.
|
8352
|
+
|
8353
|
+
Note, `@each.property` observer is called per each add or replace of an element
|
8354
|
+
and it's not called with a specific enumeration item.
|
8355
|
+
|
8356
|
+
A `_beforeObserver` fires before a property changes.
|
8357
|
+
|
8358
|
+
A `_beforeObserver` is an alternative form of `.observesBefore()`.
|
8359
|
+
|
8360
|
+
```javascript
|
8361
|
+
App.PersonView = Ember.View.extend({
|
8362
|
+
friends: [{ name: 'Tom' }, { name: 'Stefan' }, { name: 'Kris' }],
|
8363
|
+
|
8364
|
+
valueDidChange: Ember.observer('content.value', function(obj, keyName) {
|
8365
|
+
// only run if updating a value already in the DOM
|
8366
|
+
if (this.get('state') === 'inDOM') {
|
8367
|
+
var color = obj.get(keyName) > this.changingFrom ? 'green' : 'red';
|
8368
|
+
// logic
|
8369
|
+
}
|
8370
|
+
}),
|
8371
|
+
|
8372
|
+
friendsDidChange: Ember.observer('friends.@each.name', function(obj, keyName) {
|
8373
|
+
// some logic
|
8374
|
+
// obj.get(keyName) returns friends array
|
8375
|
+
})
|
8376
|
+
});
|
8377
|
+
```
|
8378
|
+
|
8379
|
+
Also available as `Function.prototype.observesBefore` if prototype extensions are
|
8380
|
+
enabled.
|
8381
|
+
|
8382
|
+
@method beforeObserver
|
8383
|
+
@for Ember
|
8384
|
+
@param {String} propertyNames*
|
8385
|
+
@param {Function} func
|
8386
|
+
@return func
|
8387
|
+
@deprecated
|
8388
|
+
@private
|
8389
|
+
*/
|
8390
|
+
|
8391
|
+
function _beforeObserver() {
|
8392
|
+
for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
8393
|
+
args[_key5] = arguments[_key5];
|
8394
|
+
}
|
8395
|
+
|
8396
|
+
var func = args.slice(-1)[0];
|
8397
|
+
var paths;
|
8398
|
+
|
8399
|
+
var addWatchedProperty = function (path) {
|
8400
|
+
paths.push(path);
|
8401
|
+
};
|
8402
|
+
|
8403
|
+
var _paths = args.slice(0, -1);
|
8404
|
+
|
8405
|
+
if (typeof func !== 'function') {
|
8406
|
+
// revert to old, soft-deprecated argument ordering
|
8407
|
+
|
8408
|
+
func = args[0];
|
8409
|
+
_paths = args.slice(1);
|
8410
|
+
}
|
8411
|
+
|
8412
|
+
paths = [];
|
8413
|
+
|
8414
|
+
for (var i = 0; i < _paths.length; ++i) {
|
8415
|
+
_emberMetalExpand_properties.default(_paths[i], addWatchedProperty);
|
8416
|
+
}
|
8417
|
+
|
8418
|
+
if (typeof func !== 'function') {
|
8419
|
+
throw new _emberMetalCore.default.Error('Ember.beforeObserver called without a function');
|
8420
|
+
}
|
8421
|
+
|
8422
|
+
func.__ember_observesBefore__ = paths;
|
8423
|
+
return func;
|
8424
|
+
}
|
8425
|
+
|
8348
8426
|
exports.IS_BINDING = IS_BINDING;
|
8349
8427
|
exports.Mixin = Mixin;
|
8350
8428
|
exports.required = required;
|
@@ -11514,6 +11592,7 @@ enifed('ember-metal/utils', ['exports'], function (exports) {
|
|
11514
11592
|
|
11515
11593
|
superWrapper.wrappedFunction = func;
|
11516
11594
|
superWrapper.__ember_observes__ = func.__ember_observes__;
|
11595
|
+
superWrapper.__ember_observesBefore__ = func.__ember_observesBefore__;
|
11517
11596
|
superWrapper.__ember_listens__ = func.__ember_listens__;
|
11518
11597
|
|
11519
11598
|
return superWrapper;
|
@@ -11899,6 +11978,7 @@ enifed('ember-metal/watching', ['exports', 'ember-metal/chains', 'ember-metal/wa
|
|
11899
11978
|
'use strict';
|
11900
11979
|
|
11901
11980
|
exports.isWatching = isWatching;
|
11981
|
+
exports.watcherCount = watcherCount;
|
11902
11982
|
exports.unwatch = unwatch;
|
11903
11983
|
exports.destroy = destroy;
|
11904
11984
|
|
@@ -11935,6 +12015,11 @@ enifed('ember-metal/watching', ['exports', 'ember-metal/chains', 'ember-metal/wa
|
|
11935
12015
|
return (meta && meta.peekWatching(key)) > 0;
|
11936
12016
|
}
|
11937
12017
|
|
12018
|
+
function watcherCount(obj, key) {
|
12019
|
+
var meta = _emberMetalMeta.peekMeta(obj);
|
12020
|
+
return meta && meta.peekWatching(key) || 0;
|
12021
|
+
}
|
12022
|
+
|
11938
12023
|
watch.flushPending = _emberMetalChains.flushPendingChains;
|
11939
12024
|
|
11940
12025
|
function unwatch(obj, _keyPath, m) {
|
@@ -13374,8 +13459,6 @@ enifed('ember-runtime/ext/function', ['exports', 'ember-metal/core', 'ember-meta
|
|
13374
13459
|
});
|
13375
13460
|
// Ember.EXTEND_PROTOTYPES
|
13376
13461
|
enifed('ember-runtime/ext/rsvp', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/logger', 'ember-metal/run_loop', 'rsvp'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalLogger, _emberMetalRun_loop, _rsvp) {
|
13377
|
-
/* globals RSVP:true */
|
13378
|
-
|
13379
13462
|
'use strict';
|
13380
13463
|
|
13381
13464
|
exports.onerrorDefault = onerrorDefault;
|
@@ -14652,13 +14735,10 @@ enifed('ember-runtime/mixins/controller', ['exports', 'ember-metal/mixin', 'embe
|
|
14652
14735
|
For example, when a Handlebars template uses the `{{action}}` helper,
|
14653
14736
|
it will attempt to send the action to the view's controller's `target`.
|
14654
14737
|
By default, the value of the target property is set to the router, and
|
14655
|
-
is injected when a controller is instantiated. This injection is
|
14656
|
-
|
14657
|
-
|
14658
|
-
|
14659
|
-
template, or when a controller is used as an `itemController`. In most
|
14660
|
-
cases the `target` property will automatically be set to the logical
|
14661
|
-
consumer of actions for the controller.
|
14738
|
+
is injected when a controller is instantiated. This injection is applied
|
14739
|
+
as part of the application's initialization process. In most cases the
|
14740
|
+
`target` property will automatically be set to the logical consumer of
|
14741
|
+
actions for the controller.
|
14662
14742
|
@property target
|
14663
14743
|
@default null
|
14664
14744
|
@public
|
@@ -17601,21 +17681,7 @@ enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal/debug', 'emb
|
|
17601
17681
|
@type Ember.Array
|
17602
17682
|
@private
|
17603
17683
|
*/
|
17604
|
-
content:
|
17605
|
-
get: function () {
|
17606
|
-
return this._content;
|
17607
|
-
},
|
17608
|
-
set: function (k, v) {
|
17609
|
-
if (this._didInitArrayProxy) {
|
17610
|
-
var oldContent = this._content;
|
17611
|
-
var len = oldContent ? _emberMetalProperty_get.get(oldContent, 'length') : 0;
|
17612
|
-
this.arrangedContentArrayWillChange(this, 0, len, undefined);
|
17613
|
-
this.arrangedContentWillChange(this);
|
17614
|
-
}
|
17615
|
-
this._content = v;
|
17616
|
-
return v;
|
17617
|
-
}
|
17618
|
-
}),
|
17684
|
+
content: null,
|
17619
17685
|
|
17620
17686
|
/**
|
17621
17687
|
The array that the proxy pretends to be. In the default `ArrayProxy`
|
@@ -17623,7 +17689,7 @@ enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal/debug', 'emb
|
|
17623
17689
|
can override this property to provide things like sorting and filtering.
|
17624
17690
|
@property arrangedContent
|
17625
17691
|
@private
|
17626
|
-
|
17692
|
+
*/
|
17627
17693
|
arrangedContent: _emberMetalAlias.default('content'),
|
17628
17694
|
|
17629
17695
|
/**
|
@@ -17657,7 +17723,19 @@ enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal/debug', 'emb
|
|
17657
17723
|
_emberMetalProperty_get.get(this, 'content').replace(idx, amt, objects);
|
17658
17724
|
},
|
17659
17725
|
|
17660
|
-
|
17726
|
+
/**
|
17727
|
+
Invoked when the content property is about to change. Notifies observers that the
|
17728
|
+
entire array content will change.
|
17729
|
+
@private
|
17730
|
+
@method _contentWillChange
|
17731
|
+
*/
|
17732
|
+
_contentWillChange: _emberMetalMixin._beforeObserver('content', function () {
|
17733
|
+
this._teardownContent();
|
17734
|
+
}),
|
17735
|
+
|
17736
|
+
_teardownContent: function () {
|
17737
|
+
var content = _emberMetalProperty_get.get(this, 'content');
|
17738
|
+
|
17661
17739
|
if (content) {
|
17662
17740
|
content.removeArrayObserver(this, {
|
17663
17741
|
willChange: 'contentArrayWillChange',
|
@@ -17695,7 +17773,6 @@ enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal/debug', 'emb
|
|
17695
17773
|
*/
|
17696
17774
|
_contentDidChange: _emberMetalMixin.observer('content', function () {
|
17697
17775
|
var content = _emberMetalProperty_get.get(this, 'content');
|
17698
|
-
this._teardownContent(this._prevContent);
|
17699
17776
|
|
17700
17777
|
_emberMetalDebug.assert('Can\'t set ArrayProxy\'s content to itself', content !== this);
|
17701
17778
|
|
@@ -17704,7 +17781,6 @@ enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal/debug', 'emb
|
|
17704
17781
|
|
17705
17782
|
_setupContent: function () {
|
17706
17783
|
var content = _emberMetalProperty_get.get(this, 'content');
|
17707
|
-
this._prevContent = content;
|
17708
17784
|
|
17709
17785
|
if (content) {
|
17710
17786
|
_emberMetalDebug.assert('ArrayProxy expects an Array or Ember.ArrayProxy, but you passed ' + typeof content, _emberRuntimeUtils.isArray(content) || content.isDestroyed);
|
@@ -17716,8 +17792,17 @@ enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal/debug', 'emb
|
|
17716
17792
|
}
|
17717
17793
|
},
|
17718
17794
|
|
17795
|
+
_arrangedContentWillChange: _emberMetalMixin._beforeObserver('arrangedContent', function () {
|
17796
|
+
var arrangedContent = _emberMetalProperty_get.get(this, 'arrangedContent');
|
17797
|
+
var len = arrangedContent ? _emberMetalProperty_get.get(arrangedContent, 'length') : 0;
|
17798
|
+
|
17799
|
+
this.arrangedContentArrayWillChange(this, 0, len, undefined);
|
17800
|
+
this.arrangedContentWillChange(this);
|
17801
|
+
|
17802
|
+
this._teardownArrangedContent(arrangedContent);
|
17803
|
+
}),
|
17804
|
+
|
17719
17805
|
_arrangedContentDidChange: _emberMetalMixin.observer('arrangedContent', function () {
|
17720
|
-
this._teardownArrangedContent(this._prevArrangedContent);
|
17721
17806
|
var arrangedContent = _emberMetalProperty_get.get(this, 'arrangedContent');
|
17722
17807
|
var len = arrangedContent ? _emberMetalProperty_get.get(arrangedContent, 'length') : 0;
|
17723
17808
|
|
@@ -17731,7 +17816,6 @@ enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal/debug', 'emb
|
|
17731
17816
|
|
17732
17817
|
_setupArrangedContent: function () {
|
17733
17818
|
var arrangedContent = _emberMetalProperty_get.get(this, 'arrangedContent');
|
17734
|
-
this._prevArrangedContent = arrangedContent;
|
17735
17819
|
|
17736
17820
|
if (arrangedContent) {
|
17737
17821
|
_emberMetalDebug.assert('ArrayProxy expects an Array or Ember.ArrayProxy, but you passed ' + typeof arrangedContent, _emberRuntimeUtils.isArray(arrangedContent) || arrangedContent.isDestroyed);
|
@@ -17885,7 +17969,6 @@ enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal/debug', 'emb
|
|
17885
17969
|
},
|
17886
17970
|
|
17887
17971
|
init: function () {
|
17888
|
-
this._didInitArrayProxy = true;
|
17889
17972
|
this._super.apply(this, arguments);
|
17890
17973
|
this._setupContent();
|
17891
17974
|
this._setupArrangedContent();
|
@@ -17893,7 +17976,7 @@ enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal/debug', 'emb
|
|
17893
17976
|
|
17894
17977
|
willDestroy: function () {
|
17895
17978
|
this._teardownArrangedContent();
|
17896
|
-
this._teardownContent(
|
17979
|
+
this._teardownContent();
|
17897
17980
|
}
|
17898
17981
|
});
|
17899
17982
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
7
7
|
* @license Licensed under MIT license
|
8
8
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
9
|
-
* @version 2.3.
|
9
|
+
* @version 2.3.1
|
10
10
|
*/
|
11
11
|
|
12
12
|
var enifed, requireModule, require, requirejs, Ember;
|
@@ -3026,7 +3026,6 @@ enifed('ember-metal/computed', ['exports', 'ember-metal/debug', 'ember-metal/pro
|
|
3026
3026
|
var args;
|
3027
3027
|
|
3028
3028
|
var addArg = function (property) {
|
3029
|
-
_emberMetalDebug.assert('Depending on arrays using a dependent key ending with `@each` is no longer supported. ' + ('Please refactor from `Ember.computed(\'' + property + '\', function() {});` to `Ember.computed(\'' + property.slice(0, -6) + '.[]\', function() {})`.'), property.slice(-5) !== '@each');
|
3030
3029
|
args.push(property);
|
3031
3030
|
};
|
3032
3031
|
|
@@ -4130,7 +4129,7 @@ enifed('ember-metal/core', ['exports'], function (exports) {
|
|
4130
4129
|
|
4131
4130
|
@class Ember
|
4132
4131
|
@static
|
4133
|
-
@version 2.3.
|
4132
|
+
@version 2.3.1
|
4134
4133
|
@public
|
4135
4134
|
*/
|
4136
4135
|
|
@@ -4174,11 +4173,11 @@ enifed('ember-metal/core', ['exports'], function (exports) {
|
|
4174
4173
|
|
4175
4174
|
@property VERSION
|
4176
4175
|
@type String
|
4177
|
-
@default '2.3.
|
4176
|
+
@default '2.3.1'
|
4178
4177
|
@static
|
4179
4178
|
@public
|
4180
4179
|
*/
|
4181
|
-
Ember.VERSION = '2.3.
|
4180
|
+
Ember.VERSION = '2.3.1';
|
4182
4181
|
|
4183
4182
|
/**
|
4184
4183
|
The hash of environment variables used to control various configuration
|
@@ -4915,6 +4914,8 @@ enifed('ember-metal/expand_properties', ['exports', 'ember-metal/error'], functi
|
|
4915
4914
|
|
4916
4915
|
var SPLIT_REGEX = /\{|\}/;
|
4917
4916
|
|
4917
|
+
var END_WITH_EACH_REGEX = /\.@each$/;
|
4918
|
+
|
4918
4919
|
/**
|
4919
4920
|
Expands `pattern`, invoking `callback` for each expansion.
|
4920
4921
|
|
@@ -4959,10 +4960,10 @@ enifed('ember-metal/expand_properties', ['exports', 'ember-metal/error'], functi
|
|
4959
4960
|
});
|
4960
4961
|
|
4961
4962
|
properties.forEach(function (property) {
|
4962
|
-
callback(property.join(''));
|
4963
|
+
callback(property.join('').replace(END_WITH_EACH_REGEX, '.[]'));
|
4963
4964
|
});
|
4964
4965
|
} else {
|
4965
|
-
callback(pattern);
|
4966
|
+
callback(pattern.replace(END_WITH_EACH_REGEX, '.[]'));
|
4966
4967
|
}
|
4967
4968
|
}
|
4968
4969
|
|
@@ -6841,6 +6842,7 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/error',
|
|
6841
6842
|
exports.aliasMethod = aliasMethod;
|
6842
6843
|
exports.observer = observer;
|
6843
6844
|
exports._immediateObserver = _immediateObserver;
|
6845
|
+
exports._beforeObserver = _beforeObserver;
|
6844
6846
|
|
6845
6847
|
function ROOT() {}
|
6846
6848
|
ROOT.__hasSuper = false;
|
@@ -7164,11 +7166,13 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/error',
|
|
7164
7166
|
var prev = obj[key];
|
7165
7167
|
|
7166
7168
|
if ('function' === typeof prev) {
|
7169
|
+
updateObserversAndListeners(obj, key, prev, '__ember_observesBefore__', _emberMetalObserver._removeBeforeObserver);
|
7167
7170
|
updateObserversAndListeners(obj, key, prev, '__ember_observes__', _emberMetalObserver.removeObserver);
|
7168
7171
|
updateObserversAndListeners(obj, key, prev, '__ember_listens__', _emberMetalEvents.removeListener);
|
7169
7172
|
}
|
7170
7173
|
|
7171
7174
|
if ('function' === typeof observerOrListener) {
|
7175
|
+
updateObserversAndListeners(obj, key, observerOrListener, '__ember_observesBefore__', _emberMetalObserver._addBeforeObserver);
|
7172
7176
|
updateObserversAndListeners(obj, key, observerOrListener, '__ember_observes__', _emberMetalObserver.addObserver);
|
7173
7177
|
updateObserversAndListeners(obj, key, observerOrListener, '__ember_listens__', _emberMetalEvents.addListener);
|
7174
7178
|
}
|
@@ -7607,8 +7611,6 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/error',
|
|
7607
7611
|
var paths;
|
7608
7612
|
|
7609
7613
|
var addWatchedProperty = function (path) {
|
7610
|
-
_emberMetalDebug.assert('Depending on arrays using a dependent key ending with `@each` is no longer supported. ' + ('Please refactor from `Ember.observer(\'' + path + '\', function() {});` to `Ember.observer(\'' + path.slice(0, -6) + '.[]\', function() {})`.'), path.slice(-5) !== '@each');
|
7611
|
-
|
7612
7614
|
paths.push(path);
|
7613
7615
|
};
|
7614
7616
|
var _paths = args.slice(0, -1);
|
@@ -7672,6 +7674,82 @@ enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/error',
|
|
7672
7674
|
return observer.apply(this, arguments);
|
7673
7675
|
}
|
7674
7676
|
|
7677
|
+
/**
|
7678
|
+
When observers fire, they are called with the arguments `obj`, `keyName`.
|
7679
|
+
|
7680
|
+
Note, `@each.property` observer is called per each add or replace of an element
|
7681
|
+
and it's not called with a specific enumeration item.
|
7682
|
+
|
7683
|
+
A `_beforeObserver` fires before a property changes.
|
7684
|
+
|
7685
|
+
A `_beforeObserver` is an alternative form of `.observesBefore()`.
|
7686
|
+
|
7687
|
+
```javascript
|
7688
|
+
App.PersonView = Ember.View.extend({
|
7689
|
+
friends: [{ name: 'Tom' }, { name: 'Stefan' }, { name: 'Kris' }],
|
7690
|
+
|
7691
|
+
valueDidChange: Ember.observer('content.value', function(obj, keyName) {
|
7692
|
+
// only run if updating a value already in the DOM
|
7693
|
+
if (this.get('state') === 'inDOM') {
|
7694
|
+
var color = obj.get(keyName) > this.changingFrom ? 'green' : 'red';
|
7695
|
+
// logic
|
7696
|
+
}
|
7697
|
+
}),
|
7698
|
+
|
7699
|
+
friendsDidChange: Ember.observer('friends.@each.name', function(obj, keyName) {
|
7700
|
+
// some logic
|
7701
|
+
// obj.get(keyName) returns friends array
|
7702
|
+
})
|
7703
|
+
});
|
7704
|
+
```
|
7705
|
+
|
7706
|
+
Also available as `Function.prototype.observesBefore` if prototype extensions are
|
7707
|
+
enabled.
|
7708
|
+
|
7709
|
+
@method beforeObserver
|
7710
|
+
@for Ember
|
7711
|
+
@param {String} propertyNames*
|
7712
|
+
@param {Function} func
|
7713
|
+
@return func
|
7714
|
+
@deprecated
|
7715
|
+
@private
|
7716
|
+
*/
|
7717
|
+
|
7718
|
+
function _beforeObserver() {
|
7719
|
+
for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
7720
|
+
args[_key5] = arguments[_key5];
|
7721
|
+
}
|
7722
|
+
|
7723
|
+
var func = args.slice(-1)[0];
|
7724
|
+
var paths;
|
7725
|
+
|
7726
|
+
var addWatchedProperty = function (path) {
|
7727
|
+
paths.push(path);
|
7728
|
+
};
|
7729
|
+
|
7730
|
+
var _paths = args.slice(0, -1);
|
7731
|
+
|
7732
|
+
if (typeof func !== 'function') {
|
7733
|
+
// revert to old, soft-deprecated argument ordering
|
7734
|
+
|
7735
|
+
func = args[0];
|
7736
|
+
_paths = args.slice(1);
|
7737
|
+
}
|
7738
|
+
|
7739
|
+
paths = [];
|
7740
|
+
|
7741
|
+
for (var i = 0; i < _paths.length; ++i) {
|
7742
|
+
_emberMetalExpand_properties.default(_paths[i], addWatchedProperty);
|
7743
|
+
}
|
7744
|
+
|
7745
|
+
if (typeof func !== 'function') {
|
7746
|
+
throw new _emberMetalCore.default.Error('Ember.beforeObserver called without a function');
|
7747
|
+
}
|
7748
|
+
|
7749
|
+
func.__ember_observesBefore__ = paths;
|
7750
|
+
return func;
|
7751
|
+
}
|
7752
|
+
|
7675
7753
|
exports.IS_BINDING = IS_BINDING;
|
7676
7754
|
exports.Mixin = Mixin;
|
7677
7755
|
exports.required = required;
|
@@ -10825,6 +10903,7 @@ enifed('ember-metal/utils', ['exports'], function (exports) {
|
|
10825
10903
|
|
10826
10904
|
superWrapper.wrappedFunction = func;
|
10827
10905
|
superWrapper.__ember_observes__ = func.__ember_observes__;
|
10906
|
+
superWrapper.__ember_observesBefore__ = func.__ember_observesBefore__;
|
10828
10907
|
superWrapper.__ember_listens__ = func.__ember_listens__;
|
10829
10908
|
|
10830
10909
|
return superWrapper;
|
@@ -11204,6 +11283,7 @@ enifed('ember-metal/watching', ['exports', 'ember-metal/chains', 'ember-metal/wa
|
|
11204
11283
|
'use strict';
|
11205
11284
|
|
11206
11285
|
exports.isWatching = isWatching;
|
11286
|
+
exports.watcherCount = watcherCount;
|
11207
11287
|
exports.unwatch = unwatch;
|
11208
11288
|
exports.destroy = destroy;
|
11209
11289
|
|
@@ -11240,6 +11320,11 @@ enifed('ember-metal/watching', ['exports', 'ember-metal/chains', 'ember-metal/wa
|
|
11240
11320
|
return (meta && meta.peekWatching(key)) > 0;
|
11241
11321
|
}
|
11242
11322
|
|
11323
|
+
function watcherCount(obj, key) {
|
11324
|
+
var meta = _emberMetalMeta.peekMeta(obj);
|
11325
|
+
return meta && meta.peekWatching(key) || 0;
|
11326
|
+
}
|
11327
|
+
|
11243
11328
|
watch.flushPending = _emberMetalChains.flushPendingChains;
|
11244
11329
|
|
11245
11330
|
function unwatch(obj, _keyPath, m) {
|
@@ -12568,7 +12653,7 @@ enifed('ember-template-compiler/system/compile_options', ['exports', 'ember-meta
|
|
12568
12653
|
options.buildMeta = function buildMeta(program) {
|
12569
12654
|
return {
|
12570
12655
|
fragmentReason: fragmentReason(program),
|
12571
|
-
revision: 'Ember@2.3.
|
12656
|
+
revision: 'Ember@2.3.1',
|
12572
12657
|
loc: program.loc,
|
12573
12658
|
moduleName: options.moduleName
|
12574
12659
|
};
|
@@ -18195,10 +18280,10 @@ enifed("htmlbars-syntax/parser/tokenizer-event-handlers", ["exports", "htmlbars-
|
|
18195
18280
|
if (isQuoted) {
|
18196
18281
|
return assembleConcatenatedValue(parts);
|
18197
18282
|
} else {
|
18198
|
-
if (parts.length === 1) {
|
18283
|
+
if (parts.length === 1 || parts.length === 2 && parts[1] === '/') {
|
18199
18284
|
return parts[0];
|
18200
18285
|
} else {
|
18201
|
-
throw new Error("An unquoted attribute value must be a string or a mustache, " + "preceeded by whitespace or a '=' character, and " + ("followed by whitespace
|
18286
|
+
throw new Error("An unquoted attribute value must be a string or a mustache, " + "preceeded by whitespace or a '=' character, and " + ("followed by whitespace, a '>' character or a '/>' (on line " + line + ")"));
|
18202
18287
|
}
|
18203
18288
|
}
|
18204
18289
|
} else {
|