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.
@@ -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.1
9
+ * @version 3.0.0-beta.2
10
10
  */
11
11
 
12
12
  /*globals process */
@@ -4645,15 +4645,6 @@ enifed('backburner', ['exports'], function (exports) {
4645
4645
  this.globalOptions = globalOptions;
4646
4646
  }
4647
4647
 
4648
- Queue.prototype.push = function (target, method, args, stack) {
4649
- this._queue.push(target, method, args, stack);
4650
- return {
4651
- queue: this,
4652
- target: target,
4653
- method: method
4654
- };
4655
- };
4656
-
4657
4648
  Queue.prototype.flush = function (sync) {
4658
4649
  var _options = this.options,
4659
4650
  before = _options.before,
@@ -4730,16 +4721,10 @@ enifed('backburner', ['exports'], function (exports) {
4730
4721
 
4731
4722
  var queue = this._queue;
4732
4723
  var targetQueueMap = this.targetQueues.get(target);
4733
- var index = void 0;
4734
4724
  if (targetQueueMap !== undefined) {
4735
- index = targetQueueMap.get(method);
4736
- if (index !== undefined) {
4737
- targetQueueMap.delete(method);
4738
- }
4739
- }
4740
- if (index === undefined) {
4741
- index = findItem(target, method, queue);
4725
+ targetQueueMap.delete(method);
4742
4726
  }
4727
+ var index = findItem(target, method, queue);
4743
4728
  if (index > -1) {
4744
4729
  queue.splice(index, 4);
4745
4730
  return true;
@@ -4755,6 +4740,15 @@ enifed('backburner', ['exports'], function (exports) {
4755
4740
  return false;
4756
4741
  };
4757
4742
 
4743
+ Queue.prototype.push = function (target, method, args, stack) {
4744
+ this._queue.push(target, method, args, stack);
4745
+ return {
4746
+ queue: this,
4747
+ target: target,
4748
+ method: method
4749
+ };
4750
+ };
4751
+
4758
4752
  Queue.prototype.pushUnique = function (target, method, args, stack) {
4759
4753
  var localQueueMap = this.targetQueues.get(target),
4760
4754
  queueIndex,
@@ -4832,10 +4826,10 @@ enifed('backburner', ['exports'], function (exports) {
4832
4826
  DeferredActionQueues.prototype.schedule = function (queueName, target, method, args, onceFlag, stack) {
4833
4827
  var queues = this.queues;
4834
4828
  var queue = queues[queueName];
4835
- if (!queue) {
4829
+ if (queue === undefined) {
4836
4830
  noSuchQueue(queueName);
4837
4831
  }
4838
- if (!method) {
4832
+ if (method === undefined || method === null) {
4839
4833
  noSuchMethod(queueName);
4840
4834
  }
4841
4835
  if (onceFlag) {
@@ -5184,28 +5178,45 @@ enifed('backburner', ['exports'], function (exports) {
5184
5178
  return this._setTimeout(fn, executeAt);
5185
5179
  };
5186
5180
 
5187
- Backburner.prototype.throttle = function (target, method) /*, ...args, wait, [immediate] */{
5181
+ Backburner.prototype.throttle = function (targetOrThisArgOrMethod) {
5188
5182
  var _this2 = this,
5189
5183
  _len4,
5190
5184
  args,
5191
5185
  _key4;
5192
5186
 
5193
- for (_len4 = arguments.length, args = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
5194
- args[_key4 - 2] = arguments[_key4];
5195
- }
5196
-
5197
- var immediate = args.pop();
5187
+ var target = void 0;
5188
+ var method = void 0;
5189
+ var immediate = void 0;
5198
5190
  var isImmediate = void 0;
5199
5191
  var wait = void 0;
5200
- if (isCoercableNumber(immediate)) {
5201
- wait = immediate;
5192
+
5193
+ for (_len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
5194
+ args[_key4 - 1] = arguments[_key4];
5195
+ }
5196
+
5197
+ if (args.length === 1) {
5198
+ method = targetOrThisArgOrMethod;
5199
+ wait = args.pop();
5200
+ target = null;
5202
5201
  isImmediate = true;
5203
5202
  } else {
5204
- wait = args.pop();
5205
- isImmediate = immediate === true;
5206
- }
5207
- if (isString(method)) {
5208
- method = target[method];
5203
+ target = targetOrThisArgOrMethod;
5204
+ method = args.shift();
5205
+ immediate = args.pop();
5206
+ if (isString(method)) {
5207
+ method = target[method];
5208
+ } else if (!isFunction(method)) {
5209
+ args.unshift(method);
5210
+ method = target;
5211
+ target = null;
5212
+ }
5213
+ if (isCoercableNumber(immediate)) {
5214
+ wait = immediate;
5215
+ isImmediate = true;
5216
+ } else {
5217
+ wait = args.pop();
5218
+ isImmediate = immediate === true;
5219
+ }
5209
5220
  }
5210
5221
  var index = findItem(target, method, this._throttlers);
5211
5222
  if (index > -1) {
@@ -5232,29 +5243,46 @@ enifed('backburner', ['exports'], function (exports) {
5232
5243
  return timer;
5233
5244
  };
5234
5245
 
5235
- Backburner.prototype.debounce = function (target, method) /* , wait, [immediate] */{
5246
+ Backburner.prototype.debounce = function (targetOrThisArgOrMethod) {
5236
5247
  var _this3 = this,
5237
5248
  _len5,
5238
5249
  args,
5239
5250
  _key5,
5240
5251
  timerId;
5241
5252
 
5242
- for (_len5 = arguments.length, args = Array(_len5 > 2 ? _len5 - 2 : 0), _key5 = 2; _key5 < _len5; _key5++) {
5243
- args[_key5 - 2] = arguments[_key5];
5244
- }
5245
-
5246
- var immediate = args.pop();
5253
+ var target = void 0;
5254
+ var method = void 0;
5255
+ var immediate = void 0;
5247
5256
  var isImmediate = void 0;
5248
5257
  var wait = void 0;
5249
- if (isCoercableNumber(immediate)) {
5250
- wait = immediate;
5258
+
5259
+ for (_len5 = arguments.length, args = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
5260
+ args[_key5 - 1] = arguments[_key5];
5261
+ }
5262
+
5263
+ if (args.length === 1) {
5264
+ method = targetOrThisArgOrMethod;
5265
+ wait = args.pop();
5266
+ target = null;
5251
5267
  isImmediate = false;
5252
5268
  } else {
5253
- wait = args.pop();
5254
- isImmediate = immediate === true;
5255
- }
5256
- if (isString(method)) {
5257
- method = target[method];
5269
+ target = targetOrThisArgOrMethod;
5270
+ method = args.shift();
5271
+ immediate = args.pop();
5272
+ if (isString(method)) {
5273
+ method = target[method];
5274
+ } else if (!isFunction(method)) {
5275
+ args.unshift(method);
5276
+ method = target;
5277
+ target = null;
5278
+ }
5279
+ if (isCoercableNumber(immediate)) {
5280
+ wait = immediate;
5281
+ isImmediate = false;
5282
+ } else {
5283
+ wait = args.pop();
5284
+ isImmediate = immediate === true;
5285
+ }
5258
5286
  }
5259
5287
  wait = parseInt(wait, 10);
5260
5288
  // Remove debouncee
@@ -6513,9 +6541,16 @@ enifed("ember-console", ["exports"], function (exports) {
6513
6541
  return (_console4 = console).info.apply(_console4, arguments);
6514
6542
  },
6515
6543
  debug: function () {
6516
- var _console5, _console6;
6544
+ var _console6, _console5;
6517
6545
 
6518
- return console.debug && (_console5 = console).debug.apply(_console5, arguments) || (_console6 = console).info.apply(_console6, arguments); // eslint-disable-line no-console
6546
+ /* eslint-disable no-console */
6547
+ if (console.debug) {
6548
+
6549
+ return (_console5 = console).debug.apply(_console5, arguments);
6550
+ }
6551
+
6552
+ return (_console6 = console).info.apply(_console6, arguments);
6553
+ /* eslint-enable no-console */
6519
6554
  },
6520
6555
  assert: function () {
6521
6556
  var _console7;
@@ -7487,12 +7522,11 @@ enifed('ember-environment', ['exports'], function (exports) {
7487
7522
  exports.context = context;
7488
7523
  exports.environment = environment;
7489
7524
  });
7490
- enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-debug', 'ember/features', 'ember-babel', '@glimmer/reference', 'require', 'backburner', 'ember-console'], function (exports, emberEnvironment, emberUtils, emberDebug, features, emberBabel, reference, require, Backburner, Logger) {
7525
+ 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) {
7491
7526
  'use strict';
7492
7527
 
7493
7528
  require = require && require.hasOwnProperty('default') ? require['default'] : require;
7494
7529
  Backburner = Backburner && Backburner.hasOwnProperty('default') ? Backburner['default'] : Backburner;
7495
- Logger = Logger && Logger.hasOwnProperty('default') ? Logger['default'] : Logger;
7496
7530
 
7497
7531
  /**
7498
7532
  @module ember
@@ -8405,9 +8439,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
8405
8439
  //
8406
8440
  // This should only be used by the target of the observer
8407
8441
  // while it is setting the observed path.
8408
- function _suspendObserver(obj, path, target, method, callback) {
8409
- return suspendListener(obj, changeEvent(path), target, method, callback);
8410
- }
8442
+
8411
8443
 
8412
8444
  /**
8413
8445
  @method removeBeforeObserver
@@ -8822,7 +8854,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
8822
8854
  // development to aid in development asertions. Production builds of
8823
8855
  // ember strip this entire branch out.
8824
8856
  messageFor = function (obj, keyName, property, value) {
8825
- 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.';
8857
+ 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.';
8826
8858
  };
8827
8859
  trapFor = void 0;
8828
8860
 
@@ -8834,7 +8866,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
8834
8866
  get: function (descriptor, property) {
8835
8867
  if (property === DESCRIPTOR) {
8836
8868
  return descriptor;
8837
- } else if (property === 'toString' || property == 'valueOf' || Symbol && property === Symbol.toPrimitive) {
8869
+ } else if (property === 'prototype' || property === 'constructor' || property === 'nodeType') {
8870
+ return undefined;
8871
+ } else if (property === 'toString' || property === 'valueOf' || property === 'inspect' || Symbol && property === Symbol.toPrimitive || Symbol && property === Symbol.toStringTag) {
8838
8872
  return function () {
8839
8873
  return '[COMPUTED PROPERTY]';
8840
8874
  };
@@ -9605,7 +9639,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
9605
9639
 
9606
9640
  this._watching = undefined;
9607
9641
  this._mixins = undefined;
9608
- this._bindings = undefined;
9642
+ if (emberEnvironment.ENV._ENABLE_BINDING_SUPPORT) {
9643
+ this._bindings = undefined;
9644
+ }
9609
9645
  this._values = undefined;
9610
9646
  this._deps = undefined;
9611
9647
  this._chainWatchers = undefined;
@@ -9951,6 +9987,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
9951
9987
  };
9952
9988
 
9953
9989
  Meta.prototype.writeBindings = function (subkey, value) {
9990
+ 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);
9954
9991
  true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot add a binding for `' + subkey + '` on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
9955
9992
 
9956
9993
  var map = this._getOrCreateOwnMap('_bindings');
@@ -9958,10 +9995,14 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
9958
9995
  };
9959
9996
 
9960
9997
  Meta.prototype.peekBindings = function (subkey) {
9998
+ 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);
9999
+
9961
10000
  return this._findInherited('_bindings', subkey);
9962
10001
  };
9963
10002
 
9964
10003
  Meta.prototype.forEachBindings = function (fn) {
10004
+ 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);
10005
+
9965
10006
  var pointer = this,
9966
10007
  map;
9967
10008
  var seen = void 0;
@@ -9982,6 +10023,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
9982
10023
  };
9983
10024
 
9984
10025
  Meta.prototype.clearBindings = function () {
10026
+ 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);
9985
10027
  true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot clear bindings on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
9986
10028
 
9987
10029
  this._bindings = undefined;
@@ -10313,32 +10355,20 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
10313
10355
  return key.indexOf('.');
10314
10356
  });
10315
10357
 
10316
- var firstKeyCache = new Cache(1000, function (path) {
10358
+ new Cache(1000, function (path) {
10317
10359
  var index = firstDotIndexCache.get(path);
10318
10360
  return index === -1 ? path : path.slice(0, index);
10319
10361
  });
10320
-
10321
- var tailPathCache = new Cache(1000, function (path) {
10362
+ new Cache(1000, function (path) {
10322
10363
  var index = firstDotIndexCache.get(path);
10323
10364
  return index === -1 ? undefined : path.slice(index + 1);
10324
10365
  });
10325
10366
 
10326
- function isGlobalPath(path) {
10327
- return isGlobalPathCache.get(path);
10328
- }
10329
10367
 
10330
10368
  function isPath(path) {
10331
10369
  return firstDotIndexCache.get(path) !== -1;
10332
10370
  }
10333
10371
 
10334
- function getFirstKey(path) {
10335
- return firstKeyCache.get(path);
10336
- }
10337
-
10338
- function getTailPath(path) {
10339
- return tailPathCache.get(path);
10340
- }
10341
-
10342
10372
  /**
10343
10373
  @module @ember/object
10344
10374
  */
@@ -10601,9 +10631,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
10601
10631
  @param {Object} value The value to set
10602
10632
  @public
10603
10633
  */
10604
- function trySet(root, path, value) {
10605
- return set(root, path, value, true);
10606
- }
10634
+
10607
10635
 
10608
10636
  /**
10609
10637
  @module @ember/object
@@ -13191,487 +13219,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
13191
13219
  */
13192
13220
 
13193
13221
 
13194
- /**
13195
- @module ember
13196
- */
13197
-
13198
- // ..........................................................
13199
- // BINDING
13200
- //
13201
-
13202
- var Binding = function () {
13203
- function Binding(toPath, fromPath) {
13204
-
13205
- // Configuration
13206
- this._from = fromPath;
13207
- this._to = toPath;
13208
- this._oneWay = undefined;
13209
-
13210
- // State
13211
- this._direction = undefined;
13212
- this._readyToSync = undefined;
13213
- this._fromObj = undefined;
13214
- this._fromPath = undefined;
13215
- this._toObj = undefined;
13216
- }
13217
-
13218
- /**
13219
- @class Binding
13220
- @namespace Ember
13221
- @deprecated See https://emberjs.com/deprecations/v2.x#toc_ember-binding
13222
- @public
13223
- */
13224
-
13225
- /**
13226
- This copies the Binding so it can be connected to another object.
13227
- @method copy
13228
- @return {Ember.Binding} `this`
13229
- @public
13230
- */
13231
-
13232
- Binding.prototype.copy = function () {
13233
- var copy = new Binding(this._to, this._from);
13234
- if (this._oneWay) {
13235
- copy._oneWay = true;
13236
- }
13237
- return copy;
13238
- };
13239
-
13240
- // ..........................................................
13241
- // CONFIG
13242
- //
13243
-
13244
- /**
13245
- This will set `from` property path to the specified value. It will not
13246
- attempt to resolve this property path to an actual object until you
13247
- connect the binding.
13248
- The binding will search for the property path starting at the root object
13249
- you pass when you `connect()` the binding. It follows the same rules as
13250
- `get()` - see that method for more information.
13251
- @method from
13252
- @param {String} path The property path to connect to.
13253
- @return {Ember.Binding} `this`
13254
- @public
13255
- */
13256
-
13257
- Binding.prototype.from = function (path) {
13258
- this._from = path;
13259
- return this;
13260
- };
13261
-
13262
- /**
13263
- This will set the `to` property path to the specified value. It will not
13264
- attempt to resolve this property path to an actual object until you
13265
- connect the binding.
13266
- The binding will search for the property path starting at the root object
13267
- you pass when you `connect()` the binding. It follows the same rules as
13268
- `get()` - see that method for more information.
13269
- @method to
13270
- @param {String|Tuple} path A property path or tuple.
13271
- @return {Ember.Binding} `this`
13272
- @public
13273
- */
13274
-
13275
- Binding.prototype.to = function (path) {
13276
- this._to = path;
13277
- return this;
13278
- };
13279
-
13280
- /**
13281
- Configures the binding as one way. A one-way binding will relay changes
13282
- on the `from` side to the `to` side, but not the other way around. This
13283
- means that if you change the `to` side directly, the `from` side may have
13284
- a different value.
13285
- @method oneWay
13286
- @return {Ember.Binding} `this`
13287
- @public
13288
- */
13289
-
13290
- Binding.prototype.oneWay = function () {
13291
- this._oneWay = true;
13292
- return this;
13293
- };
13294
-
13295
- /**
13296
- @method toString
13297
- @return {String} string representation of binding
13298
- @public
13299
- */
13300
-
13301
- Binding.prototype.toString = function () {
13302
- var oneWay = this._oneWay ? '[oneWay]' : '';
13303
- return 'Ember.Binding<' + emberUtils.guidFor(this) + '>(' + this._from + ' -> ' + this._to + ')' + oneWay;
13304
- };
13305
-
13306
- // ..........................................................
13307
- // CONNECT AND SYNC
13308
- //
13309
-
13310
- /**
13311
- Attempts to connect this binding instance so that it can receive and relay
13312
- changes. This method will raise an exception if you have not set the
13313
- from/to properties yet.
13314
- @method connect
13315
- @param {Object} obj The root object for this binding.
13316
- @return {Ember.Binding} `this`
13317
- @public
13318
- */
13319
-
13320
- Binding.prototype.connect = function (obj) {
13321
- true && !!!obj && emberDebug.assert('Must pass a valid object to Ember.Binding.connect()', !!obj);
13322
-
13323
- var fromObj = void 0,
13324
- fromPath = void 0,
13325
- possibleGlobal = void 0,
13326
- name;
13327
-
13328
- // If the binding's "from" path could be interpreted as a global, verify
13329
- // whether the path refers to a global or not by consulting `Ember.lookup`.
13330
- if (isGlobalPath(this._from)) {
13331
- name = getFirstKey(this._from);
13332
-
13333
- possibleGlobal = emberEnvironment.context.lookup[name];
13334
-
13335
- if (possibleGlobal) {
13336
- fromObj = possibleGlobal;
13337
- fromPath = getTailPath(this._from);
13338
- }
13339
- }
13340
-
13341
- if (fromObj === undefined) {
13342
- fromObj = obj;
13343
- fromPath = this._from;
13344
- }
13345
-
13346
- trySet(obj, this._to, get(fromObj, fromPath));
13347
-
13348
- // Add an observer on the object to be notified when the binding should be updated.
13349
- addObserver(fromObj, fromPath, this, 'fromDidChange');
13350
-
13351
- // If the binding is a two-way binding, also set up an observer on the target.
13352
- if (!this._oneWay) {
13353
- addObserver(obj, this._to, this, 'toDidChange');
13354
- }
13355
-
13356
- addListener(obj, 'willDestroy', this, 'disconnect');
13357
-
13358
- fireDeprecations(obj, this._to, this._from, possibleGlobal, this._oneWay, !possibleGlobal && !this._oneWay);
13359
-
13360
- this._readyToSync = true;
13361
- this._fromObj = fromObj;
13362
- this._fromPath = fromPath;
13363
- this._toObj = obj;
13364
-
13365
- return this;
13366
- };
13367
-
13368
- /**
13369
- Disconnects the binding instance. Changes will no longer be relayed. You
13370
- will not usually need to call this method.
13371
- @method disconnect
13372
- @return {Ember.Binding} `this`
13373
- @public
13374
- */
13375
-
13376
- Binding.prototype.disconnect = function () {
13377
- true && !!!this._toObj && emberDebug.assert('Must pass a valid object to Ember.Binding.disconnect()', !!this._toObj);
13378
-
13379
- // Remove an observer on the object so we're no longer notified of
13380
- // changes that should update bindings.
13381
-
13382
- removeObserver(this._fromObj, this._fromPath, this, 'fromDidChange');
13383
-
13384
- // If the binding is two-way, remove the observer from the target as well.
13385
- if (!this._oneWay) {
13386
- removeObserver(this._toObj, this._to, this, 'toDidChange');
13387
- }
13388
-
13389
- this._readyToSync = false; // Disable scheduled syncs...
13390
- return this;
13391
- };
13392
-
13393
- // ..........................................................
13394
- // PRIVATE
13395
- //
13396
-
13397
- /* Called when the from side changes. */
13398
-
13399
- Binding.prototype.fromDidChange = function () {
13400
- // eslint-disable-line no-unused-vars
13401
- this._scheduleSync('fwd');
13402
- };
13403
-
13404
- /* Called when the to side changes. */
13405
-
13406
- Binding.prototype.toDidChange = function () {
13407
- // eslint-disable-line no-unused-vars
13408
- this._scheduleSync('back');
13409
- };
13410
-
13411
- Binding.prototype._scheduleSync = function (dir) {
13412
- var existingDir = this._direction;
13413
-
13414
- // If we haven't scheduled the binding yet, schedule it.
13415
- if (existingDir === undefined) {
13416
- run.schedule('sync', this, '_sync');
13417
- this._direction = dir;
13418
- }
13419
-
13420
- // If both a 'back' and 'fwd' sync have been scheduled on the same object,
13421
- // default to a 'fwd' sync so that it remains deterministic.
13422
- if (existingDir === 'back' && dir === 'fwd') {
13423
- this._direction = 'fwd';
13424
- }
13425
- };
13426
-
13427
- Binding.prototype._sync = function () {
13428
- var log = emberEnvironment.ENV.LOG_BINDINGS,
13429
- fromValue,
13430
- toValue;
13431
-
13432
- var toObj = this._toObj;
13433
-
13434
- // Don't synchronize destroyed objects or disconnected bindings.
13435
- if (toObj.isDestroyed || !this._readyToSync) {
13436
- return;
13437
- }
13438
-
13439
- // Get the direction of the binding for the object we are
13440
- // synchronizing from.
13441
- var direction = this._direction;
13442
-
13443
- var fromObj = this._fromObj;
13444
- var fromPath = this._fromPath;
13445
-
13446
- this._direction = undefined;
13447
-
13448
- // If we're synchronizing from the remote object...
13449
- if (direction === 'fwd') {
13450
- fromValue = get(fromObj, fromPath);
13451
-
13452
- if (log) {
13453
- Logger.log(' ', this.toString(), '->', fromValue, fromObj);
13454
- }
13455
- if (this._oneWay) {
13456
- trySet(toObj, this._to, fromValue);
13457
- } else {
13458
- _suspendObserver(toObj, this._to, this, 'toDidChange', function () {
13459
- trySet(toObj, this._to, fromValue);
13460
- });
13461
- }
13462
- // If we're synchronizing *to* the remote object.
13463
- } else if (direction === 'back') {
13464
- toValue = get(toObj, this._to);
13465
-
13466
- if (log) {
13467
- Logger.log(' ', this.toString(), '<-', toValue, toObj);
13468
- }
13469
- _suspendObserver(fromObj, fromPath, this, 'fromDidChange', function () {
13470
- trySet(fromObj, fromPath, toValue);
13471
- });
13472
- }
13473
- };
13474
-
13475
- return Binding;
13476
- }();
13477
-
13478
- function fireDeprecations(obj, toPath, fromPath, deprecateGlobal, deprecateOneWay, deprecateAlias) {
13479
-
13480
- var objectInfo = 'The `' + toPath + '` property of `' + obj + '` is an `Ember.Binding` connected to `' + fromPath + '`, but ';
13481
- true && !!deprecateGlobal && emberDebug.deprecate(objectInfo + ('`Ember.Binding` is deprecated. Since you' + ' are binding to a global consider using a service instead.'), !deprecateGlobal, {
13482
- id: 'ember-metal.binding',
13483
- until: '3.0.0',
13484
- url: 'https://emberjs.com/deprecations/v2.x#toc_ember-binding'
13485
- });
13486
- true && !!deprecateOneWay && emberDebug.deprecate(objectInfo + ('`Ember.Binding` is deprecated. Since you' + ' are using a `oneWay` binding consider using a `readOnly` computed' + ' property instead.'), !deprecateOneWay, {
13487
- id: 'ember-metal.binding',
13488
- until: '3.0.0',
13489
- url: 'https://emberjs.com/deprecations/v2.x#toc_ember-binding'
13490
- });
13491
- true && !!deprecateAlias && emberDebug.deprecate(objectInfo + ('`Ember.Binding` is deprecated. Consider' + ' using an `alias` computed property instead.'), !deprecateAlias, {
13492
- id: 'ember-metal.binding',
13493
- until: '3.0.0',
13494
- url: 'https://emberjs.com/deprecations/v2.x#toc_ember-binding'
13495
- });
13496
- }
13497
-
13498
- (function (to, from) {
13499
- for (var key in from) {
13500
- if (from.hasOwnProperty(key)) {
13501
- to[key] = from[key];
13502
- }
13503
- }
13504
- })(Binding, {
13505
-
13506
- /*
13507
- See `Ember.Binding.from`.
13508
- @method from
13509
- @static
13510
- */
13511
- from: function (from) {
13512
- var C = this;
13513
- return new C(undefined, from);
13514
- },
13515
-
13516
- /*
13517
- See `Ember.Binding.to`.
13518
- @method to
13519
- @static
13520
- */
13521
- to: function (to) {
13522
- var C = this;
13523
- return new C(to, undefined);
13524
- }
13525
- });
13526
- /**
13527
- An `Ember.Binding` connects the properties of two objects so that whenever
13528
- the value of one property changes, the other property will be changed also.
13529
-
13530
- ## Automatic Creation of Bindings with `/^*Binding/`-named Properties.
13531
-
13532
- You do not usually create Binding objects directly but instead describe
13533
- bindings in your class or object definition using automatic binding
13534
- detection.
13535
-
13536
- Properties ending in a `Binding` suffix will be converted to `Ember.Binding`
13537
- instances. The value of this property should be a string representing a path
13538
- to another object or a custom binding instance created using Binding helpers
13539
- (see "One Way Bindings"):
13540
-
13541
- ```
13542
- valueBinding: "MyApp.someController.title"
13543
- ```
13544
-
13545
- This will create a binding from `MyApp.someController.title` to the `value`
13546
- property of your object instance automatically. Now the two values will be
13547
- kept in sync.
13548
-
13549
- ## One Way Bindings
13550
-
13551
- One especially useful binding customization you can use is the `oneWay()`
13552
- helper. This helper tells Ember that you are only interested in
13553
- receiving changes on the object you are binding from. For example, if you
13554
- are binding to a preference and you want to be notified if the preference
13555
- has changed, but your object will not be changing the preference itself, you
13556
- could do:
13557
-
13558
- ```
13559
- bigTitlesBinding: Ember.Binding.oneWay("MyApp.preferencesController.bigTitles")
13560
- ```
13561
-
13562
- This way if the value of `MyApp.preferencesController.bigTitles` changes the
13563
- `bigTitles` property of your object will change also. However, if you
13564
- change the value of your `bigTitles` property, it will not update the
13565
- `preferencesController`.
13566
-
13567
- One way bindings are almost twice as fast to setup and twice as fast to
13568
- execute because the binding only has to worry about changes to one side.
13569
-
13570
- You should consider using one way bindings anytime you have an object that
13571
- may be created frequently and you do not intend to change a property; only
13572
- to monitor it for changes (such as in the example above).
13573
-
13574
- ## Adding Bindings Manually
13575
-
13576
- All of the examples above show you how to configure a custom binding, but the
13577
- result of these customizations will be a binding template, not a fully active
13578
- Binding instance. The binding will actually become active only when you
13579
- instantiate the object the binding belongs to. It is useful, however, to
13580
- understand what actually happens when the binding is activated.
13581
-
13582
- For a binding to function it must have at least a `from` property and a `to`
13583
- property. The `from` property path points to the object/key that you want to
13584
- bind from while the `to` path points to the object/key you want to bind to.
13585
-
13586
- When you define a custom binding, you are usually describing the property
13587
- you want to bind from (such as `MyApp.someController.value` in the examples
13588
- above). When your object is created, it will automatically assign the value
13589
- you want to bind `to` based on the name of your binding key. In the
13590
- examples above, during init, Ember objects will effectively call
13591
- something like this on your binding:
13592
-
13593
- ```javascript
13594
- binding = Ember.Binding.from("valueBinding").to("value");
13595
- ```
13596
-
13597
- This creates a new binding instance based on the template you provide, and
13598
- sets the to path to the `value` property of the new object. Now that the
13599
- binding is fully configured with a `from` and a `to`, it simply needs to be
13600
- connected to become active. This is done through the `connect()` method:
13601
-
13602
- ```javascript
13603
- binding.connect(this);
13604
- ```
13605
-
13606
- Note that when you connect a binding you pass the object you want it to be
13607
- connected to. This object will be used as the root for both the from and
13608
- to side of the binding when inspecting relative paths. This allows the
13609
- binding to be automatically inherited by subclassed objects as well.
13610
-
13611
- This also allows you to bind between objects using the paths you declare in
13612
- `from` and `to`:
13613
-
13614
- ```javascript
13615
- // Example 1
13616
- binding = Ember.Binding.from("App.someObject.value").to("value");
13617
- binding.connect(this);
13618
-
13619
- // Example 2
13620
- binding = Ember.Binding.from("parentView.value").to("App.someObject.value");
13621
- binding.connect(this);
13622
- ```
13623
-
13624
- Now that the binding is connected, it will observe both the from and to side
13625
- and relay changes.
13626
-
13627
- If you ever needed to do so (you almost never will, but it is useful to
13628
- understand this anyway), you could manually create an active binding by
13629
- using the `Ember.bind()` helper method. (This is the same method used by
13630
- to setup your bindings on objects):
13631
-
13632
- ```javascript
13633
- Ember.bind(MyApp.anotherObject, "value", "MyApp.someController.value");
13634
- ```
13635
-
13636
- Both of these code fragments have the same effect as doing the most friendly
13637
- form of binding creation like so:
13638
-
13639
- ```javascript
13640
- MyApp.anotherObject = Ember.Object.create({
13641
- valueBinding: "MyApp.someController.value",
13642
-
13643
- // OTHER CODE FOR THIS OBJECT...
13644
- });
13645
- ```
13646
-
13647
- Ember's built in binding creation method makes it easy to automatically
13648
- create bindings for you. You should always use the highest-level APIs
13649
- available, even if you understand how it works underneath.
13650
-
13651
- @class Binding
13652
- @namespace Ember
13653
- @since Ember 0.9
13654
- @public
13655
- */
13656
- // Ember.Binding = Binding; ES6TODO: where to put this?
13657
-
13658
-
13659
- /**
13660
- Global helper method to create a new binding. Just pass the root object
13661
- along with a `to` and `from` path to create and connect the binding.
13662
-
13663
- @method bind
13664
- @for Ember
13665
- @param {Object} obj The root object of the transform.
13666
- @param {String} to The path to the 'to' side of the binding.
13667
- Must be relative to obj.
13668
- @param {String} from The path to the 'from' side of the binding.
13669
- Must be relative to obj or a global path.
13670
- @return {Ember.Binding} binding instance
13671
- @public
13672
- */
13673
-
13674
-
13675
13222
  /**
13676
13223
  @module @ember/object
13677
13224
  */
@@ -13909,43 +13456,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
13909
13456
  }
13910
13457
  }
13911
13458
 
13912
- function detectBinding(key) {
13913
- var length = key.length;
13914
-
13915
- return length > 7 && key.charCodeAt(length - 7) === 66 && key.indexOf('inding', length - 6) !== -1;
13916
- }
13917
- // warm both paths of above function
13918
- detectBinding('notbound');
13919
- detectBinding('fooBinding');
13920
-
13921
- function connectBindings(obj, meta$$1) {
13922
- // TODO Mixin.apply(instance) should disconnect binding if exists
13923
- meta$$1.forEachBindings(function (key, binding) {
13924
- var to;
13925
-
13926
- if (binding) {
13927
- to = key.slice(0, -7); // strip Binding off end
13928
-
13929
- if (binding instanceof Binding) {
13930
- binding = binding.copy(); // copy prototypes' instance
13931
- binding.to(to);
13932
- } else {
13933
- // binding is string path
13934
- binding = new Binding(to, binding);
13935
- }
13936
- binding.connect(obj);
13937
- obj[key] = binding;
13938
- }
13939
- });
13940
- // mark as applied
13941
- meta$$1.clearBindings();
13942
- }
13943
-
13944
- function finishPartial(obj, meta$$1) {
13945
- connectBindings(obj, meta$$1 === undefined ? meta(obj) : meta$$1);
13946
- return obj;
13947
- }
13948
-
13949
13459
  function followAlias(obj, desc, descs, values) {
13950
13460
  var altKey = desc.methodName;
13951
13461
  var value = void 0;
@@ -14040,16 +13550,16 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
14040
13550
  replaceObserversAndListeners(obj, key, obj[key], value);
14041
13551
  }
14042
13552
 
14043
- if (detectBinding(key)) {
13553
+ if (emberEnvironment.ENV._ENABLE_BINDING_SUPPORT && Mixin.detectBinding(key)) {
14044
13554
  meta$$1.writeBindings(key, value);
14045
13555
  }
14046
13556
 
14047
13557
  defineProperty(obj, key, desc, value, meta$$1);
14048
13558
  }
14049
13559
 
14050
- if (!partial) {
13560
+ if (emberEnvironment.ENV._ENABLE_BINDING_SUPPORT && !partial) {
14051
13561
  // don't apply to prototype
14052
- finishPartial(obj, meta$$1);
13562
+ Mixin.finishPartial(obj, meta$$1);
14053
13563
  }
14054
13564
 
14055
13565
  return obj;
@@ -14333,7 +13843,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
14333
13843
  }();
14334
13844
 
14335
13845
  Mixin._apply = applyMixin;
14336
- Mixin.finishPartial = finishPartial;
13846
+ if (emberEnvironment.ENV._ENABLE_BINDING_SUPPORT) {
13847
+ // slotting this so that the legacy addon can add the function here
13848
+ // without triggering an error due to the Object.seal done below
13849
+ Mixin.finishPartial = null;
13850
+ Mixin.detectBinding = null;
13851
+ }
14337
13852
 
14338
13853
  var MixinPrototype = Mixin.prototype;
14339
13854
  MixinPrototype.toString = Object.toString;
@@ -14719,7 +14234,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
14719
14234
  return value;
14720
14235
  };
14721
14236
  exports.set = set;
14722
- exports.trySet = trySet;
14237
+ exports.trySet = function (root, path, value) {
14238
+ return set(root, path, value, true);
14239
+ };
14723
14240
  exports.addListener = addListener;
14724
14241
  exports.hasListeners = function (obj, eventName) {
14725
14242
  var meta$$1 = peekMeta(obj);
@@ -14840,7 +14357,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
14840
14357
  return properties;
14841
14358
  };
14842
14359
  exports.expandProperties = expandProperties;
14843
- exports._suspendObserver = _suspendObserver;
14360
+ exports._suspendObserver = function (obj, path, target, method, callback) {
14361
+ return suspendListener(obj, changeEvent(path), target, method, callback);
14362
+ };
14844
14363
  exports._suspendObservers = function (obj, paths, target, method, callback) {
14845
14364
  var events = paths.map(changeEvent);
14846
14365
  return suspendListeners(obj, events, target, method, callback);
@@ -14935,12 +14454,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
14935
14454
  exports.clearUnprocessedMixins = function () {
14936
14455
  unprocessedFlag = false;
14937
14456
  };
14938
- exports.detectBinding = detectBinding;
14939
- exports.Binding = Binding;
14940
- exports.bind = function (obj, to, from) {
14941
- return new Binding(to, from).connect(obj);
14457
+ exports.isGlobalPath = function (path) {
14458
+ return isGlobalPathCache.get(path);
14942
14459
  };
14943
- exports.isGlobalPath = isGlobalPath;
14944
14460
  exports.InjectedProperty = InjectedProperty;
14945
14461
  exports.setHasViews = function (fn) {
14946
14462
  hasViews = fn;
@@ -16708,6 +16224,10 @@ enifed('ember-utils', ['exports'], function (exports) {
16708
16224
  return obj !== null && obj !== undefined && typeof obj[methodName] === 'function';
16709
16225
  }
16710
16226
 
16227
+ /**
16228
+ @module @ember/utils
16229
+ */
16230
+
16711
16231
  /**
16712
16232
  Checks to see if the `methodName` exists on the `obj`,
16713
16233
  and if it does, invokes it with the arguments passed.
@@ -16721,7 +16241,8 @@ enifed('ember-utils', ['exports'], function (exports) {
16721
16241
  ```
16722
16242
 
16723
16243
  @method tryInvoke
16724
- @for Ember
16244
+ @for @ember/utils
16245
+ @static
16725
16246
  @param {Object} obj The object to check for the method
16726
16247
  @param {String} methodName The method name to check for
16727
16248
  @param {Array} [args] The arguments to pass to the method
@@ -17003,7 +16524,7 @@ enifed('ember/features', ['exports', 'ember-environment', 'ember-utils'], functi
17003
16524
  enifed("ember/version", ["exports"], function (exports) {
17004
16525
  "use strict";
17005
16526
 
17006
- exports.default = "3.0.0-beta.1";
16527
+ exports.default = "3.0.0-beta.2";
17007
16528
  });
17008
16529
  enifed("handlebars", ["exports"], function (exports) {
17009
16530
  "use strict";