ember-source 3.0.0.beta.1 → 3.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dist/ember-runtime.js +34 -540
- data/dist/ember-template-compiler.js +125 -604
- data/dist/ember-testing.js +1 -1
- data/dist/ember-tests.js +91 -1280
- data/dist/ember-tests.prod.js +84 -1219
- data/dist/ember.debug.js +173 -603
- data/dist/ember.min.js +383 -393
- data/dist/ember.prod.js +177 -593
- data/package.json +12 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 723b977912b61af64c74c1f323a5f81b98245f55763dac476fc6095910ad5cc2
|
4
|
+
data.tar.gz: e3d2fa6950c749c202fa88180ce991738c504f8efaa427755cb080da957f16ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc08a3cd71deeb309bc2399d5f4dba002ace28b8aed22a6f9418a64f3d063df02a4a21de56cd25a184310d5303cfccedcfc55dc274854248518a09c9f8578742
|
7
|
+
data.tar.gz: 44407db1a2ec0e64feadbd3a3b48b77ebba15a9db987b206419a3e70f510ec775de8b85557960ca0d354c949436ef7ab3bc1701eacd1feb81a2923be0748e93a
|
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 3.0.0-beta.
|
9
|
+
* @version 3.0.0-beta.2
|
10
10
|
*/
|
11
11
|
|
12
12
|
/*globals process */
|
@@ -1140,9 +1140,17 @@ enifed("ember-console", ["exports"], function (exports) {
|
|
1140
1140
|
return (_console4 = console).info.apply(_console4, arguments);
|
1141
1141
|
},
|
1142
1142
|
debug: function () {
|
1143
|
-
var
|
1143
|
+
var _console6;
|
1144
1144
|
|
1145
|
-
|
1145
|
+
/* eslint-disable no-console */
|
1146
|
+
if (console.debug) {
|
1147
|
+
var _console5;
|
1148
|
+
|
1149
|
+
return (_console5 = console).debug.apply(_console5, arguments);
|
1150
|
+
}
|
1151
|
+
|
1152
|
+
return (_console6 = console).info.apply(_console6, arguments);
|
1153
|
+
/* eslint-enable no-console */
|
1146
1154
|
},
|
1147
1155
|
assert: function () {
|
1148
1156
|
var _console7;
|
@@ -1311,12 +1319,11 @@ enifed('ember-environment', ['exports'], function (exports) {
|
|
1311
1319
|
exports.context = context;
|
1312
1320
|
exports.environment = environment;
|
1313
1321
|
});
|
1314
|
-
enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-debug', 'ember/features', 'ember-babel', '@glimmer/reference', 'require', 'backburner'
|
1322
|
+
enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-debug', 'ember/features', 'ember-babel', '@glimmer/reference', 'require', 'backburner'], function (exports, emberEnvironment, emberUtils, emberDebug, features, emberBabel, reference, require, Backburner) {
|
1315
1323
|
'use strict';
|
1316
1324
|
|
1317
1325
|
require = require && require.hasOwnProperty('default') ? require['default'] : require;
|
1318
1326
|
Backburner = Backburner && Backburner.hasOwnProperty('default') ? Backburner['default'] : Backburner;
|
1319
|
-
Logger = Logger && Logger.hasOwnProperty('default') ? Logger['default'] : Logger;
|
1320
1327
|
|
1321
1328
|
/**
|
1322
1329
|
@module ember
|
@@ -2670,7 +2677,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
2670
2677
|
// development to aid in development asertions. Production builds of
|
2671
2678
|
// ember strip this entire branch out.
|
2672
2679
|
var messageFor = function (obj, keyName, property, value) {
|
2673
|
-
return 'You attempted to access the `' + keyName + '.' + property + '` property ' + ('(of ' + obj + '). Due to certain internal implementation details of Ember, ') + ('the `' + keyName + '` property previously contained an internal "descriptor" ') + ('object (a private API), therefore `' + keyName + '.' + property + '` would have ') + ('been `' + String(value).replace(/\n/g, ' ') + '`. This internal implementation ') + 'detail was never intended to be a public (or even intimate) API.\n\n' + 'This internal implementation detail has now changed and the (still private) ' + '"descriptor" object has been relocated to the object\'s "meta" (also a ' + ('private API). Soon, accessing `' + keyName + '` on this object will ') + 'return the computed value (see RFC #281 for more details).\n\n' + 'If you are seeing this error, you are likely using an addon that ' + 'relies on this now-defunct private implementation detail. If you can, ' + 'find out which addon is doing this from the stack trace below and ' + 'report this bug to the addon authors. If you feel stuck, the Ember ' + 'Community Slack (https://ember-community-slackin.herokuapp.com/) ' + 'may be able to offer some help.\n\n' + 'If you are an addon author and need help transitioning your code, ' + 'please get in touch in the #dev-ember channel in the Ember Community ' + 'Slack.';
|
2680
|
+
return 'You attempted to access the `' + keyName + '.' + String(property) + '` property ' + ('(of ' + obj + '). Due to certain internal implementation details of Ember, ') + ('the `' + keyName + '` property previously contained an internal "descriptor" ') + ('object (a private API), therefore `' + keyName + '.' + String(property) + '` would have ') + ('been `' + String(value).replace(/\n/g, ' ') + '`. This internal implementation ') + 'detail was never intended to be a public (or even intimate) API.\n\n' + 'This internal implementation detail has now changed and the (still private) ' + '"descriptor" object has been relocated to the object\'s "meta" (also a ' + ('private API). Soon, accessing `' + keyName + '` on this object will ') + 'return the computed value (see RFC #281 for more details).\n\n' + 'If you are seeing this error, you are likely using an addon that ' + 'relies on this now-defunct private implementation detail. If you can, ' + 'find out which addon is doing this from the stack trace below and ' + 'report this bug to the addon authors. If you feel stuck, the Ember ' + 'Community Slack (https://ember-community-slackin.herokuapp.com/) ' + 'may be able to offer some help.\n\n' + 'If you are an addon author and need help transitioning your code, ' + 'please get in touch in the #dev-ember channel in the Ember Community ' + 'Slack.';
|
2674
2681
|
};
|
2675
2682
|
|
2676
2683
|
var trapFor = void 0;
|
@@ -2682,7 +2689,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
2682
2689
|
get: function (descriptor, property) {
|
2683
2690
|
if (property === DESCRIPTOR) {
|
2684
2691
|
return descriptor;
|
2685
|
-
} else if (property === '
|
2692
|
+
} else if (property === 'prototype' || property === 'constructor' || property === 'nodeType') {
|
2693
|
+
return undefined;
|
2694
|
+
} else if (property === 'toString' || property === 'valueOf' || property === 'inspect' || Symbol && property === Symbol.toPrimitive || Symbol && property === Symbol.toStringTag) {
|
2686
2695
|
return function () {
|
2687
2696
|
return '[COMPUTED PROPERTY]';
|
2688
2697
|
};
|
@@ -3434,7 +3443,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
3434
3443
|
|
3435
3444
|
this._watching = undefined;
|
3436
3445
|
this._mixins = undefined;
|
3437
|
-
|
3446
|
+
if (emberEnvironment.ENV._ENABLE_BINDING_SUPPORT) {
|
3447
|
+
this._bindings = undefined;
|
3448
|
+
}
|
3438
3449
|
this._values = undefined;
|
3439
3450
|
this._deps = undefined;
|
3440
3451
|
this._chainWatchers = undefined;
|
@@ -3757,6 +3768,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
3757
3768
|
};
|
3758
3769
|
|
3759
3770
|
Meta.prototype.writeBindings = function writeBindings(subkey, value) {
|
3771
|
+
true && !emberEnvironment.ENV._ENABLE_BINDING_SUPPORT && emberDebug.assert('Cannot invoke `meta.writeBindings` when EmberENV._ENABLE_BINDING_SUPPORT is not set', emberEnvironment.ENV._ENABLE_BINDING_SUPPORT);
|
3760
3772
|
true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot add a binding for `' + subkey + '` on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
|
3761
3773
|
|
3762
3774
|
var map = this._getOrCreateOwnMap('_bindings');
|
@@ -3764,10 +3776,14 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
3764
3776
|
};
|
3765
3777
|
|
3766
3778
|
Meta.prototype.peekBindings = function peekBindings(subkey) {
|
3779
|
+
true && !emberEnvironment.ENV._ENABLE_BINDING_SUPPORT && emberDebug.assert('Cannot invoke `meta.peekBindings` when EmberENV._ENABLE_BINDING_SUPPORT is not set', emberEnvironment.ENV._ENABLE_BINDING_SUPPORT);
|
3780
|
+
|
3767
3781
|
return this._findInherited('_bindings', subkey);
|
3768
3782
|
};
|
3769
3783
|
|
3770
3784
|
Meta.prototype.forEachBindings = function forEachBindings(fn) {
|
3785
|
+
true && !emberEnvironment.ENV._ENABLE_BINDING_SUPPORT && emberDebug.assert('Cannot invoke `meta.forEachBindings` when EmberENV._ENABLE_BINDING_SUPPORT is not set', emberEnvironment.ENV._ENABLE_BINDING_SUPPORT);
|
3786
|
+
|
3771
3787
|
var pointer = this;
|
3772
3788
|
var seen = void 0;
|
3773
3789
|
while (pointer !== undefined) {
|
@@ -3786,6 +3802,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
3786
3802
|
};
|
3787
3803
|
|
3788
3804
|
Meta.prototype.clearBindings = function clearBindings() {
|
3805
|
+
true && !emberEnvironment.ENV._ENABLE_BINDING_SUPPORT && emberDebug.assert('Cannot invoke `meta.clearBindings` when EmberENV._ENABLE_BINDING_SUPPORT is not set', emberEnvironment.ENV._ENABLE_BINDING_SUPPORT);
|
3789
3806
|
true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot clear bindings on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
|
3790
3807
|
|
3791
3808
|
this._bindings = undefined;
|
@@ -4143,14 +4160,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
4143
4160
|
return firstDotIndexCache.get(path) !== -1;
|
4144
4161
|
}
|
4145
4162
|
|
4146
|
-
function getFirstKey(path) {
|
4147
|
-
return firstKeyCache.get(path);
|
4148
|
-
}
|
4149
|
-
|
4150
|
-
function getTailPath(path) {
|
4151
|
-
return tailPathCache.get(path);
|
4152
|
-
}
|
4153
|
-
|
4154
4163
|
/**
|
4155
4164
|
@module @ember/object
|
4156
4165
|
*/
|
@@ -7121,489 +7130,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
7121
7130
|
return properties;
|
7122
7131
|
}
|
7123
7132
|
|
7124
|
-
/**
|
7125
|
-
@module ember
|
7126
|
-
*/
|
7127
|
-
|
7128
|
-
// ..........................................................
|
7129
|
-
// BINDING
|
7130
|
-
//
|
7131
|
-
|
7132
|
-
var Binding = function () {
|
7133
|
-
function Binding(toPath, fromPath) {
|
7134
|
-
emberBabel.classCallCheck(this, Binding);
|
7135
|
-
|
7136
|
-
// Configuration
|
7137
|
-
this._from = fromPath;
|
7138
|
-
this._to = toPath;
|
7139
|
-
this._oneWay = undefined;
|
7140
|
-
|
7141
|
-
// State
|
7142
|
-
this._direction = undefined;
|
7143
|
-
this._readyToSync = undefined;
|
7144
|
-
this._fromObj = undefined;
|
7145
|
-
this._fromPath = undefined;
|
7146
|
-
this._toObj = undefined;
|
7147
|
-
}
|
7148
|
-
|
7149
|
-
/**
|
7150
|
-
@class Binding
|
7151
|
-
@namespace Ember
|
7152
|
-
@deprecated See https://emberjs.com/deprecations/v2.x#toc_ember-binding
|
7153
|
-
@public
|
7154
|
-
*/
|
7155
|
-
|
7156
|
-
/**
|
7157
|
-
This copies the Binding so it can be connected to another object.
|
7158
|
-
@method copy
|
7159
|
-
@return {Ember.Binding} `this`
|
7160
|
-
@public
|
7161
|
-
*/
|
7162
|
-
|
7163
|
-
Binding.prototype.copy = function copy() {
|
7164
|
-
var copy = new Binding(this._to, this._from);
|
7165
|
-
if (this._oneWay) {
|
7166
|
-
copy._oneWay = true;
|
7167
|
-
}
|
7168
|
-
return copy;
|
7169
|
-
};
|
7170
|
-
|
7171
|
-
// ..........................................................
|
7172
|
-
// CONFIG
|
7173
|
-
//
|
7174
|
-
|
7175
|
-
/**
|
7176
|
-
This will set `from` property path to the specified value. It will not
|
7177
|
-
attempt to resolve this property path to an actual object until you
|
7178
|
-
connect the binding.
|
7179
|
-
The binding will search for the property path starting at the root object
|
7180
|
-
you pass when you `connect()` the binding. It follows the same rules as
|
7181
|
-
`get()` - see that method for more information.
|
7182
|
-
@method from
|
7183
|
-
@param {String} path The property path to connect to.
|
7184
|
-
@return {Ember.Binding} `this`
|
7185
|
-
@public
|
7186
|
-
*/
|
7187
|
-
|
7188
|
-
Binding.prototype.from = function from(path) {
|
7189
|
-
this._from = path;
|
7190
|
-
return this;
|
7191
|
-
};
|
7192
|
-
|
7193
|
-
/**
|
7194
|
-
This will set the `to` property path to the specified value. It will not
|
7195
|
-
attempt to resolve this property path to an actual object until you
|
7196
|
-
connect the binding.
|
7197
|
-
The binding will search for the property path starting at the root object
|
7198
|
-
you pass when you `connect()` the binding. It follows the same rules as
|
7199
|
-
`get()` - see that method for more information.
|
7200
|
-
@method to
|
7201
|
-
@param {String|Tuple} path A property path or tuple.
|
7202
|
-
@return {Ember.Binding} `this`
|
7203
|
-
@public
|
7204
|
-
*/
|
7205
|
-
|
7206
|
-
Binding.prototype.to = function to(path) {
|
7207
|
-
this._to = path;
|
7208
|
-
return this;
|
7209
|
-
};
|
7210
|
-
|
7211
|
-
/**
|
7212
|
-
Configures the binding as one way. A one-way binding will relay changes
|
7213
|
-
on the `from` side to the `to` side, but not the other way around. This
|
7214
|
-
means that if you change the `to` side directly, the `from` side may have
|
7215
|
-
a different value.
|
7216
|
-
@method oneWay
|
7217
|
-
@return {Ember.Binding} `this`
|
7218
|
-
@public
|
7219
|
-
*/
|
7220
|
-
|
7221
|
-
Binding.prototype.oneWay = function oneWay() {
|
7222
|
-
this._oneWay = true;
|
7223
|
-
return this;
|
7224
|
-
};
|
7225
|
-
|
7226
|
-
/**
|
7227
|
-
@method toString
|
7228
|
-
@return {String} string representation of binding
|
7229
|
-
@public
|
7230
|
-
*/
|
7231
|
-
|
7232
|
-
Binding.prototype.toString = function toString$$1() {
|
7233
|
-
var oneWay = this._oneWay ? '[oneWay]' : '';
|
7234
|
-
return 'Ember.Binding<' + emberUtils.guidFor(this) + '>(' + this._from + ' -> ' + this._to + ')' + oneWay;
|
7235
|
-
};
|
7236
|
-
|
7237
|
-
// ..........................................................
|
7238
|
-
// CONNECT AND SYNC
|
7239
|
-
//
|
7240
|
-
|
7241
|
-
/**
|
7242
|
-
Attempts to connect this binding instance so that it can receive and relay
|
7243
|
-
changes. This method will raise an exception if you have not set the
|
7244
|
-
from/to properties yet.
|
7245
|
-
@method connect
|
7246
|
-
@param {Object} obj The root object for this binding.
|
7247
|
-
@return {Ember.Binding} `this`
|
7248
|
-
@public
|
7249
|
-
*/
|
7250
|
-
|
7251
|
-
Binding.prototype.connect = function connect(obj) {
|
7252
|
-
true && !!!obj && emberDebug.assert('Must pass a valid object to Ember.Binding.connect()', !!obj);
|
7253
|
-
|
7254
|
-
var fromObj = void 0,
|
7255
|
-
fromPath = void 0,
|
7256
|
-
possibleGlobal = void 0;
|
7257
|
-
|
7258
|
-
// If the binding's "from" path could be interpreted as a global, verify
|
7259
|
-
// whether the path refers to a global or not by consulting `Ember.lookup`.
|
7260
|
-
if (isGlobalPath(this._from)) {
|
7261
|
-
var name = getFirstKey(this._from);
|
7262
|
-
possibleGlobal = emberEnvironment.context.lookup[name];
|
7263
|
-
|
7264
|
-
if (possibleGlobal) {
|
7265
|
-
fromObj = possibleGlobal;
|
7266
|
-
fromPath = getTailPath(this._from);
|
7267
|
-
}
|
7268
|
-
}
|
7269
|
-
|
7270
|
-
if (fromObj === undefined) {
|
7271
|
-
fromObj = obj;
|
7272
|
-
fromPath = this._from;
|
7273
|
-
}
|
7274
|
-
|
7275
|
-
trySet(obj, this._to, get(fromObj, fromPath));
|
7276
|
-
|
7277
|
-
// Add an observer on the object to be notified when the binding should be updated.
|
7278
|
-
addObserver(fromObj, fromPath, this, 'fromDidChange');
|
7279
|
-
|
7280
|
-
// If the binding is a two-way binding, also set up an observer on the target.
|
7281
|
-
if (!this._oneWay) {
|
7282
|
-
addObserver(obj, this._to, this, 'toDidChange');
|
7283
|
-
}
|
7284
|
-
|
7285
|
-
addListener(obj, 'willDestroy', this, 'disconnect');
|
7286
|
-
|
7287
|
-
fireDeprecations(obj, this._to, this._from, possibleGlobal, this._oneWay, !possibleGlobal && !this._oneWay);
|
7288
|
-
|
7289
|
-
this._readyToSync = true;
|
7290
|
-
this._fromObj = fromObj;
|
7291
|
-
this._fromPath = fromPath;
|
7292
|
-
this._toObj = obj;
|
7293
|
-
|
7294
|
-
return this;
|
7295
|
-
};
|
7296
|
-
|
7297
|
-
/**
|
7298
|
-
Disconnects the binding instance. Changes will no longer be relayed. You
|
7299
|
-
will not usually need to call this method.
|
7300
|
-
@method disconnect
|
7301
|
-
@return {Ember.Binding} `this`
|
7302
|
-
@public
|
7303
|
-
*/
|
7304
|
-
|
7305
|
-
Binding.prototype.disconnect = function disconnect() {
|
7306
|
-
true && !!!this._toObj && emberDebug.assert('Must pass a valid object to Ember.Binding.disconnect()', !!this._toObj);
|
7307
|
-
|
7308
|
-
// Remove an observer on the object so we're no longer notified of
|
7309
|
-
// changes that should update bindings.
|
7310
|
-
|
7311
|
-
removeObserver(this._fromObj, this._fromPath, this, 'fromDidChange');
|
7312
|
-
|
7313
|
-
// If the binding is two-way, remove the observer from the target as well.
|
7314
|
-
if (!this._oneWay) {
|
7315
|
-
removeObserver(this._toObj, this._to, this, 'toDidChange');
|
7316
|
-
}
|
7317
|
-
|
7318
|
-
this._readyToSync = false; // Disable scheduled syncs...
|
7319
|
-
return this;
|
7320
|
-
};
|
7321
|
-
|
7322
|
-
// ..........................................................
|
7323
|
-
// PRIVATE
|
7324
|
-
//
|
7325
|
-
|
7326
|
-
/* Called when the from side changes. */
|
7327
|
-
|
7328
|
-
Binding.prototype.fromDidChange = function fromDidChange(target) {
|
7329
|
-
// eslint-disable-line no-unused-vars
|
7330
|
-
this._scheduleSync('fwd');
|
7331
|
-
};
|
7332
|
-
|
7333
|
-
/* Called when the to side changes. */
|
7334
|
-
|
7335
|
-
Binding.prototype.toDidChange = function toDidChange(target) {
|
7336
|
-
// eslint-disable-line no-unused-vars
|
7337
|
-
this._scheduleSync('back');
|
7338
|
-
};
|
7339
|
-
|
7340
|
-
Binding.prototype._scheduleSync = function _scheduleSync(dir) {
|
7341
|
-
var existingDir = this._direction;
|
7342
|
-
|
7343
|
-
// If we haven't scheduled the binding yet, schedule it.
|
7344
|
-
if (existingDir === undefined) {
|
7345
|
-
run.schedule('sync', this, '_sync');
|
7346
|
-
this._direction = dir;
|
7347
|
-
}
|
7348
|
-
|
7349
|
-
// If both a 'back' and 'fwd' sync have been scheduled on the same object,
|
7350
|
-
// default to a 'fwd' sync so that it remains deterministic.
|
7351
|
-
if (existingDir === 'back' && dir === 'fwd') {
|
7352
|
-
this._direction = 'fwd';
|
7353
|
-
}
|
7354
|
-
};
|
7355
|
-
|
7356
|
-
Binding.prototype._sync = function _sync() {
|
7357
|
-
var log = emberEnvironment.ENV.LOG_BINDINGS;
|
7358
|
-
|
7359
|
-
var toObj = this._toObj;
|
7360
|
-
|
7361
|
-
// Don't synchronize destroyed objects or disconnected bindings.
|
7362
|
-
if (toObj.isDestroyed || !this._readyToSync) {
|
7363
|
-
return;
|
7364
|
-
}
|
7365
|
-
|
7366
|
-
// Get the direction of the binding for the object we are
|
7367
|
-
// synchronizing from.
|
7368
|
-
var direction = this._direction;
|
7369
|
-
|
7370
|
-
var fromObj = this._fromObj;
|
7371
|
-
var fromPath = this._fromPath;
|
7372
|
-
|
7373
|
-
this._direction = undefined;
|
7374
|
-
|
7375
|
-
// If we're synchronizing from the remote object...
|
7376
|
-
if (direction === 'fwd') {
|
7377
|
-
var fromValue = get(fromObj, fromPath);
|
7378
|
-
if (log) {
|
7379
|
-
Logger.log(' ', this.toString(), '->', fromValue, fromObj);
|
7380
|
-
}
|
7381
|
-
if (this._oneWay) {
|
7382
|
-
trySet(toObj, this._to, fromValue);
|
7383
|
-
} else {
|
7384
|
-
_suspendObserver(toObj, this._to, this, 'toDidChange', function () {
|
7385
|
-
trySet(toObj, this._to, fromValue);
|
7386
|
-
});
|
7387
|
-
}
|
7388
|
-
// If we're synchronizing *to* the remote object.
|
7389
|
-
} else if (direction === 'back') {
|
7390
|
-
var toValue = get(toObj, this._to);
|
7391
|
-
if (log) {
|
7392
|
-
Logger.log(' ', this.toString(), '<-', toValue, toObj);
|
7393
|
-
}
|
7394
|
-
_suspendObserver(fromObj, fromPath, this, 'fromDidChange', function () {
|
7395
|
-
trySet(fromObj, fromPath, toValue);
|
7396
|
-
});
|
7397
|
-
}
|
7398
|
-
};
|
7399
|
-
|
7400
|
-
return Binding;
|
7401
|
-
}();
|
7402
|
-
|
7403
|
-
function fireDeprecations(obj, toPath, fromPath, deprecateGlobal, deprecateOneWay, deprecateAlias) {
|
7404
|
-
var deprecateGlobalMessage = '`Ember.Binding` is deprecated. Since you' + ' are binding to a global consider using a service instead.';
|
7405
|
-
var deprecateOneWayMessage = '`Ember.Binding` is deprecated. Since you' + ' are using a `oneWay` binding consider using a `readOnly` computed' + ' property instead.';
|
7406
|
-
var deprecateAliasMessage = '`Ember.Binding` is deprecated. Consider' + ' using an `alias` computed property instead.';
|
7407
|
-
|
7408
|
-
var objectInfo = 'The `' + toPath + '` property of `' + obj + '` is an `Ember.Binding` connected to `' + fromPath + '`, but ';
|
7409
|
-
true && !!deprecateGlobal && emberDebug.deprecate(objectInfo + deprecateGlobalMessage, !deprecateGlobal, {
|
7410
|
-
id: 'ember-metal.binding',
|
7411
|
-
until: '3.0.0',
|
7412
|
-
url: 'https://emberjs.com/deprecations/v2.x#toc_ember-binding'
|
7413
|
-
});
|
7414
|
-
true && !!deprecateOneWay && emberDebug.deprecate(objectInfo + deprecateOneWayMessage, !deprecateOneWay, {
|
7415
|
-
id: 'ember-metal.binding',
|
7416
|
-
until: '3.0.0',
|
7417
|
-
url: 'https://emberjs.com/deprecations/v2.x#toc_ember-binding'
|
7418
|
-
});
|
7419
|
-
true && !!deprecateAlias && emberDebug.deprecate(objectInfo + deprecateAliasMessage, !deprecateAlias, {
|
7420
|
-
id: 'ember-metal.binding',
|
7421
|
-
until: '3.0.0',
|
7422
|
-
url: 'https://emberjs.com/deprecations/v2.x#toc_ember-binding'
|
7423
|
-
});
|
7424
|
-
}
|
7425
|
-
|
7426
|
-
function mixinProperties$1(to, from) {
|
7427
|
-
for (var key in from) {
|
7428
|
-
if (from.hasOwnProperty(key)) {
|
7429
|
-
to[key] = from[key];
|
7430
|
-
}
|
7431
|
-
}
|
7432
|
-
}
|
7433
|
-
|
7434
|
-
mixinProperties$1(Binding, {
|
7435
|
-
|
7436
|
-
/*
|
7437
|
-
See `Ember.Binding.from`.
|
7438
|
-
@method from
|
7439
|
-
@static
|
7440
|
-
*/
|
7441
|
-
from: function (from) {
|
7442
|
-
var C = this;
|
7443
|
-
return new C(undefined, from);
|
7444
|
-
},
|
7445
|
-
|
7446
|
-
/*
|
7447
|
-
See `Ember.Binding.to`.
|
7448
|
-
@method to
|
7449
|
-
@static
|
7450
|
-
*/
|
7451
|
-
to: function (to) {
|
7452
|
-
var C = this;
|
7453
|
-
return new C(to, undefined);
|
7454
|
-
}
|
7455
|
-
});
|
7456
|
-
/**
|
7457
|
-
An `Ember.Binding` connects the properties of two objects so that whenever
|
7458
|
-
the value of one property changes, the other property will be changed also.
|
7459
|
-
|
7460
|
-
## Automatic Creation of Bindings with `/^*Binding/`-named Properties.
|
7461
|
-
|
7462
|
-
You do not usually create Binding objects directly but instead describe
|
7463
|
-
bindings in your class or object definition using automatic binding
|
7464
|
-
detection.
|
7465
|
-
|
7466
|
-
Properties ending in a `Binding` suffix will be converted to `Ember.Binding`
|
7467
|
-
instances. The value of this property should be a string representing a path
|
7468
|
-
to another object or a custom binding instance created using Binding helpers
|
7469
|
-
(see "One Way Bindings"):
|
7470
|
-
|
7471
|
-
```
|
7472
|
-
valueBinding: "MyApp.someController.title"
|
7473
|
-
```
|
7474
|
-
|
7475
|
-
This will create a binding from `MyApp.someController.title` to the `value`
|
7476
|
-
property of your object instance automatically. Now the two values will be
|
7477
|
-
kept in sync.
|
7478
|
-
|
7479
|
-
## One Way Bindings
|
7480
|
-
|
7481
|
-
One especially useful binding customization you can use is the `oneWay()`
|
7482
|
-
helper. This helper tells Ember that you are only interested in
|
7483
|
-
receiving changes on the object you are binding from. For example, if you
|
7484
|
-
are binding to a preference and you want to be notified if the preference
|
7485
|
-
has changed, but your object will not be changing the preference itself, you
|
7486
|
-
could do:
|
7487
|
-
|
7488
|
-
```
|
7489
|
-
bigTitlesBinding: Ember.Binding.oneWay("MyApp.preferencesController.bigTitles")
|
7490
|
-
```
|
7491
|
-
|
7492
|
-
This way if the value of `MyApp.preferencesController.bigTitles` changes the
|
7493
|
-
`bigTitles` property of your object will change also. However, if you
|
7494
|
-
change the value of your `bigTitles` property, it will not update the
|
7495
|
-
`preferencesController`.
|
7496
|
-
|
7497
|
-
One way bindings are almost twice as fast to setup and twice as fast to
|
7498
|
-
execute because the binding only has to worry about changes to one side.
|
7499
|
-
|
7500
|
-
You should consider using one way bindings anytime you have an object that
|
7501
|
-
may be created frequently and you do not intend to change a property; only
|
7502
|
-
to monitor it for changes (such as in the example above).
|
7503
|
-
|
7504
|
-
## Adding Bindings Manually
|
7505
|
-
|
7506
|
-
All of the examples above show you how to configure a custom binding, but the
|
7507
|
-
result of these customizations will be a binding template, not a fully active
|
7508
|
-
Binding instance. The binding will actually become active only when you
|
7509
|
-
instantiate the object the binding belongs to. It is useful, however, to
|
7510
|
-
understand what actually happens when the binding is activated.
|
7511
|
-
|
7512
|
-
For a binding to function it must have at least a `from` property and a `to`
|
7513
|
-
property. The `from` property path points to the object/key that you want to
|
7514
|
-
bind from while the `to` path points to the object/key you want to bind to.
|
7515
|
-
|
7516
|
-
When you define a custom binding, you are usually describing the property
|
7517
|
-
you want to bind from (such as `MyApp.someController.value` in the examples
|
7518
|
-
above). When your object is created, it will automatically assign the value
|
7519
|
-
you want to bind `to` based on the name of your binding key. In the
|
7520
|
-
examples above, during init, Ember objects will effectively call
|
7521
|
-
something like this on your binding:
|
7522
|
-
|
7523
|
-
```javascript
|
7524
|
-
binding = Ember.Binding.from("valueBinding").to("value");
|
7525
|
-
```
|
7526
|
-
|
7527
|
-
This creates a new binding instance based on the template you provide, and
|
7528
|
-
sets the to path to the `value` property of the new object. Now that the
|
7529
|
-
binding is fully configured with a `from` and a `to`, it simply needs to be
|
7530
|
-
connected to become active. This is done through the `connect()` method:
|
7531
|
-
|
7532
|
-
```javascript
|
7533
|
-
binding.connect(this);
|
7534
|
-
```
|
7535
|
-
|
7536
|
-
Note that when you connect a binding you pass the object you want it to be
|
7537
|
-
connected to. This object will be used as the root for both the from and
|
7538
|
-
to side of the binding when inspecting relative paths. This allows the
|
7539
|
-
binding to be automatically inherited by subclassed objects as well.
|
7540
|
-
|
7541
|
-
This also allows you to bind between objects using the paths you declare in
|
7542
|
-
`from` and `to`:
|
7543
|
-
|
7544
|
-
```javascript
|
7545
|
-
// Example 1
|
7546
|
-
binding = Ember.Binding.from("App.someObject.value").to("value");
|
7547
|
-
binding.connect(this);
|
7548
|
-
|
7549
|
-
// Example 2
|
7550
|
-
binding = Ember.Binding.from("parentView.value").to("App.someObject.value");
|
7551
|
-
binding.connect(this);
|
7552
|
-
```
|
7553
|
-
|
7554
|
-
Now that the binding is connected, it will observe both the from and to side
|
7555
|
-
and relay changes.
|
7556
|
-
|
7557
|
-
If you ever needed to do so (you almost never will, but it is useful to
|
7558
|
-
understand this anyway), you could manually create an active binding by
|
7559
|
-
using the `Ember.bind()` helper method. (This is the same method used by
|
7560
|
-
to setup your bindings on objects):
|
7561
|
-
|
7562
|
-
```javascript
|
7563
|
-
Ember.bind(MyApp.anotherObject, "value", "MyApp.someController.value");
|
7564
|
-
```
|
7565
|
-
|
7566
|
-
Both of these code fragments have the same effect as doing the most friendly
|
7567
|
-
form of binding creation like so:
|
7568
|
-
|
7569
|
-
```javascript
|
7570
|
-
MyApp.anotherObject = Ember.Object.create({
|
7571
|
-
valueBinding: "MyApp.someController.value",
|
7572
|
-
|
7573
|
-
// OTHER CODE FOR THIS OBJECT...
|
7574
|
-
});
|
7575
|
-
```
|
7576
|
-
|
7577
|
-
Ember's built in binding creation method makes it easy to automatically
|
7578
|
-
create bindings for you. You should always use the highest-level APIs
|
7579
|
-
available, even if you understand how it works underneath.
|
7580
|
-
|
7581
|
-
@class Binding
|
7582
|
-
@namespace Ember
|
7583
|
-
@since Ember 0.9
|
7584
|
-
@public
|
7585
|
-
*/
|
7586
|
-
// Ember.Binding = Binding; ES6TODO: where to put this?
|
7587
|
-
|
7588
|
-
|
7589
|
-
/**
|
7590
|
-
Global helper method to create a new binding. Just pass the root object
|
7591
|
-
along with a `to` and `from` path to create and connect the binding.
|
7592
|
-
|
7593
|
-
@method bind
|
7594
|
-
@for Ember
|
7595
|
-
@param {Object} obj The root object of the transform.
|
7596
|
-
@param {String} to The path to the 'to' side of the binding.
|
7597
|
-
Must be relative to obj.
|
7598
|
-
@param {String} from The path to the 'from' side of the binding.
|
7599
|
-
Must be relative to obj or a global path.
|
7600
|
-
@return {Ember.Binding} binding instance
|
7601
|
-
@public
|
7602
|
-
*/
|
7603
|
-
function bind(obj, to, from) {
|
7604
|
-
return new Binding(to, from).connect(obj);
|
7605
|
-
}
|
7606
|
-
|
7607
7133
|
/**
|
7608
7134
|
@module @ember/object
|
7609
7135
|
*/
|
@@ -7838,40 +7364,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
7838
7364
|
}
|
7839
7365
|
}
|
7840
7366
|
|
7841
|
-
function detectBinding(key) {
|
7842
|
-
var length = key.length;
|
7843
|
-
|
7844
|
-
return length > 7 && key.charCodeAt(length - 7) === 66 && key.indexOf('inding', length - 6) !== -1;
|
7845
|
-
}
|
7846
|
-
// warm both paths of above function
|
7847
|
-
detectBinding('notbound');
|
7848
|
-
detectBinding('fooBinding');
|
7849
|
-
|
7850
|
-
function connectBindings(obj, meta$$1) {
|
7851
|
-
// TODO Mixin.apply(instance) should disconnect binding if exists
|
7852
|
-
meta$$1.forEachBindings(function (key, binding) {
|
7853
|
-
if (binding) {
|
7854
|
-
var to = key.slice(0, -7); // strip Binding off end
|
7855
|
-
if (binding instanceof Binding) {
|
7856
|
-
binding = binding.copy(); // copy prototypes' instance
|
7857
|
-
binding.to(to);
|
7858
|
-
} else {
|
7859
|
-
// binding is string path
|
7860
|
-
binding = new Binding(to, binding);
|
7861
|
-
}
|
7862
|
-
binding.connect(obj);
|
7863
|
-
obj[key] = binding;
|
7864
|
-
}
|
7865
|
-
});
|
7866
|
-
// mark as applied
|
7867
|
-
meta$$1.clearBindings();
|
7868
|
-
}
|
7869
|
-
|
7870
|
-
function finishPartial(obj, meta$$1) {
|
7871
|
-
connectBindings(obj, meta$$1 === undefined ? meta(obj) : meta$$1);
|
7872
|
-
return obj;
|
7873
|
-
}
|
7874
|
-
|
7875
7367
|
function followAlias(obj, desc, descs, values) {
|
7876
7368
|
var altKey = desc.methodName;
|
7877
7369
|
var value = void 0;
|
@@ -7961,16 +7453,16 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
7961
7453
|
replaceObserversAndListeners(obj, key, obj[key], value);
|
7962
7454
|
}
|
7963
7455
|
|
7964
|
-
if (detectBinding(key)) {
|
7456
|
+
if (emberEnvironment.ENV._ENABLE_BINDING_SUPPORT && Mixin.detectBinding(key)) {
|
7965
7457
|
meta$$1.writeBindings(key, value);
|
7966
7458
|
}
|
7967
7459
|
|
7968
7460
|
defineProperty(obj, key, desc, value, meta$$1);
|
7969
7461
|
}
|
7970
7462
|
|
7971
|
-
if (!partial) {
|
7463
|
+
if (emberEnvironment.ENV._ENABLE_BINDING_SUPPORT && !partial) {
|
7972
7464
|
// don't apply to prototype
|
7973
|
-
finishPartial(obj, meta$$1);
|
7465
|
+
Mixin.finishPartial(obj, meta$$1);
|
7974
7466
|
}
|
7975
7467
|
|
7976
7468
|
return obj;
|
@@ -8249,7 +7741,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
8249
7741
|
}();
|
8250
7742
|
|
8251
7743
|
Mixin._apply = applyMixin;
|
8252
|
-
|
7744
|
+
if (emberEnvironment.ENV._ENABLE_BINDING_SUPPORT) {
|
7745
|
+
// slotting this so that the legacy addon can add the function here
|
7746
|
+
// without triggering an error due to the Object.seal done below
|
7747
|
+
Mixin.finishPartial = null;
|
7748
|
+
Mixin.detectBinding = null;
|
7749
|
+
}
|
8253
7750
|
|
8254
7751
|
var MixinPrototype = Mixin.prototype;
|
8255
7752
|
MixinPrototype.toString = Object.toString;
|
@@ -8672,9 +8169,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
|
|
8672
8169
|
exports.REQUIRED = REQUIRED;
|
8673
8170
|
exports.hasUnprocessedMixins = hasUnprocessedMixins;
|
8674
8171
|
exports.clearUnprocessedMixins = clearUnprocessedMixins;
|
8675
|
-
exports.detectBinding = detectBinding;
|
8676
|
-
exports.Binding = Binding;
|
8677
|
-
exports.bind = bind;
|
8678
8172
|
exports.isGlobalPath = isGlobalPath;
|
8679
8173
|
exports.InjectedProperty = InjectedProperty;
|
8680
8174
|
exports.setHasViews = setHasViews;
|