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 */
@@ -9494,15 +9494,6 @@ enifed('backburner', ['exports'], function (exports) {
9494
9494
  this.globalOptions = globalOptions;
9495
9495
  }
9496
9496
 
9497
- Queue.prototype.push = function (target, method, args, stack) {
9498
- this._queue.push(target, method, args, stack);
9499
- return {
9500
- queue: this,
9501
- target: target,
9502
- method: method
9503
- };
9504
- };
9505
-
9506
9497
  Queue.prototype.flush = function (sync) {
9507
9498
  var _options = this.options,
9508
9499
  before = _options.before,
@@ -9579,16 +9570,10 @@ enifed('backburner', ['exports'], function (exports) {
9579
9570
 
9580
9571
  var queue = this._queue;
9581
9572
  var targetQueueMap = this.targetQueues.get(target);
9582
- var index = void 0;
9583
9573
  if (targetQueueMap !== undefined) {
9584
- index = targetQueueMap.get(method);
9585
- if (index !== undefined) {
9586
- targetQueueMap.delete(method);
9587
- }
9588
- }
9589
- if (index === undefined) {
9590
- index = findItem(target, method, queue);
9574
+ targetQueueMap.delete(method);
9591
9575
  }
9576
+ var index = findItem(target, method, queue);
9592
9577
  if (index > -1) {
9593
9578
  queue.splice(index, 4);
9594
9579
  return true;
@@ -9604,6 +9589,15 @@ enifed('backburner', ['exports'], function (exports) {
9604
9589
  return false;
9605
9590
  };
9606
9591
 
9592
+ Queue.prototype.push = function (target, method, args, stack) {
9593
+ this._queue.push(target, method, args, stack);
9594
+ return {
9595
+ queue: this,
9596
+ target: target,
9597
+ method: method
9598
+ };
9599
+ };
9600
+
9607
9601
  Queue.prototype.pushUnique = function (target, method, args, stack) {
9608
9602
  var localQueueMap = this.targetQueues.get(target),
9609
9603
  queueIndex,
@@ -9681,10 +9675,10 @@ enifed('backburner', ['exports'], function (exports) {
9681
9675
  DeferredActionQueues.prototype.schedule = function (queueName, target, method, args, onceFlag, stack) {
9682
9676
  var queues = this.queues;
9683
9677
  var queue = queues[queueName];
9684
- if (!queue) {
9678
+ if (queue === undefined) {
9685
9679
  noSuchQueue(queueName);
9686
9680
  }
9687
- if (!method) {
9681
+ if (method === undefined || method === null) {
9688
9682
  noSuchMethod(queueName);
9689
9683
  }
9690
9684
  if (onceFlag) {
@@ -10033,28 +10027,45 @@ enifed('backburner', ['exports'], function (exports) {
10033
10027
  return this._setTimeout(fn, executeAt);
10034
10028
  };
10035
10029
 
10036
- Backburner.prototype.throttle = function (target, method) /*, ...args, wait, [immediate] */{
10030
+ Backburner.prototype.throttle = function (targetOrThisArgOrMethod) {
10037
10031
  var _this2 = this,
10038
10032
  _len4,
10039
10033
  args,
10040
10034
  _key4;
10041
10035
 
10042
- for (_len4 = arguments.length, args = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
10043
- args[_key4 - 2] = arguments[_key4];
10044
- }
10045
-
10046
- var immediate = args.pop();
10036
+ var target = void 0;
10037
+ var method = void 0;
10038
+ var immediate = void 0;
10047
10039
  var isImmediate = void 0;
10048
10040
  var wait = void 0;
10049
- if (isCoercableNumber(immediate)) {
10050
- wait = immediate;
10041
+
10042
+ for (_len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
10043
+ args[_key4 - 1] = arguments[_key4];
10044
+ }
10045
+
10046
+ if (args.length === 1) {
10047
+ method = targetOrThisArgOrMethod;
10048
+ wait = args.pop();
10049
+ target = null;
10051
10050
  isImmediate = true;
10052
10051
  } else {
10053
- wait = args.pop();
10054
- isImmediate = immediate === true;
10055
- }
10056
- if (isString(method)) {
10057
- method = target[method];
10052
+ target = targetOrThisArgOrMethod;
10053
+ method = args.shift();
10054
+ immediate = args.pop();
10055
+ if (isString(method)) {
10056
+ method = target[method];
10057
+ } else if (!isFunction(method)) {
10058
+ args.unshift(method);
10059
+ method = target;
10060
+ target = null;
10061
+ }
10062
+ if (isCoercableNumber(immediate)) {
10063
+ wait = immediate;
10064
+ isImmediate = true;
10065
+ } else {
10066
+ wait = args.pop();
10067
+ isImmediate = immediate === true;
10068
+ }
10058
10069
  }
10059
10070
  var index = findItem(target, method, this._throttlers);
10060
10071
  if (index > -1) {
@@ -10081,29 +10092,46 @@ enifed('backburner', ['exports'], function (exports) {
10081
10092
  return timer;
10082
10093
  };
10083
10094
 
10084
- Backburner.prototype.debounce = function (target, method) /* , wait, [immediate] */{
10095
+ Backburner.prototype.debounce = function (targetOrThisArgOrMethod) {
10085
10096
  var _this3 = this,
10086
10097
  _len5,
10087
10098
  args,
10088
10099
  _key5,
10089
10100
  timerId;
10090
10101
 
10091
- for (_len5 = arguments.length, args = Array(_len5 > 2 ? _len5 - 2 : 0), _key5 = 2; _key5 < _len5; _key5++) {
10092
- args[_key5 - 2] = arguments[_key5];
10093
- }
10094
-
10095
- var immediate = args.pop();
10102
+ var target = void 0;
10103
+ var method = void 0;
10104
+ var immediate = void 0;
10096
10105
  var isImmediate = void 0;
10097
10106
  var wait = void 0;
10098
- if (isCoercableNumber(immediate)) {
10099
- wait = immediate;
10107
+
10108
+ for (_len5 = arguments.length, args = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
10109
+ args[_key5 - 1] = arguments[_key5];
10110
+ }
10111
+
10112
+ if (args.length === 1) {
10113
+ method = targetOrThisArgOrMethod;
10114
+ wait = args.pop();
10115
+ target = null;
10100
10116
  isImmediate = false;
10101
10117
  } else {
10102
- wait = args.pop();
10103
- isImmediate = immediate === true;
10104
- }
10105
- if (isString(method)) {
10106
- method = target[method];
10118
+ target = targetOrThisArgOrMethod;
10119
+ method = args.shift();
10120
+ immediate = args.pop();
10121
+ if (isString(method)) {
10122
+ method = target[method];
10123
+ } else if (!isFunction(method)) {
10124
+ args.unshift(method);
10125
+ method = target;
10126
+ target = null;
10127
+ }
10128
+ if (isCoercableNumber(immediate)) {
10129
+ wait = immediate;
10130
+ isImmediate = false;
10131
+ } else {
10132
+ wait = args.pop();
10133
+ isImmediate = immediate === true;
10134
+ }
10107
10135
  }
10108
10136
  wait = parseInt(wait, 10);
10109
10137
  // Remove debouncee
@@ -11452,7 +11480,7 @@ enifed('ember-application/initializers/dom-templates', ['require', 'ember-glimme
11452
11480
  }
11453
11481
  });
11454
11482
  });
11455
- enifed('ember-application/system/application-instance', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime', 'ember-environment', 'ember-views', 'ember-application/system/engine-instance'], function (exports, _emberUtils, _emberMetal, _emberRuntime, _emberEnvironment, _emberViews, _engineInstance) {
11483
+ enifed('ember-application/system/application-instance', ['exports', 'ember-utils', 'ember-metal', 'ember-environment', 'ember-views', 'ember-application/system/engine-instance', 'ember-glimmer'], function (exports, _emberUtils, _emberMetal, _emberEnvironment, _emberViews, _engineInstance, _emberGlimmer) {
11456
11484
  'use strict';
11457
11485
 
11458
11486
  /**
@@ -11615,13 +11643,9 @@ enifed('ember-application/system/application-instance', ['exports', 'ember-utils
11615
11643
  // No rendering is needed, and routing has completed, simply return.
11616
11644
  return _this;
11617
11645
  } else {
11618
- return new _emberRuntime.RSVP.Promise(function (resolve) {
11619
- // Resolve once rendering is completed. `router.handleURL` returns the transition (as a thennable)
11620
- // which resolves once the transition is completed, but the transition completion only queues up
11621
- // a scheduled revalidation (into the `render` queue) in the Renderer.
11622
- //
11623
- // This uses `run.schedule('afterRender', ....)` to resolve after that rendering has completed.
11624
- _emberMetal.run.schedule('afterRender', null, resolve, _this);
11646
+ // Ensure that the visit promise resolves when all rendering has completed
11647
+ return (0, _emberGlimmer.renderSettled)().then(function () {
11648
+ return _this;
11625
11649
  });
11626
11650
  }
11627
11651
  };
@@ -13363,9 +13387,16 @@ enifed("ember-console", ["exports"], function (exports) {
13363
13387
  return (_console4 = console).info.apply(_console4, arguments);
13364
13388
  },
13365
13389
  debug: function () {
13366
- var _console5, _console6;
13390
+ var _console6, _console5;
13391
+
13392
+ /* eslint-disable no-console */
13393
+ if (console.debug) {
13394
+
13395
+ return (_console5 = console).debug.apply(_console5, arguments);
13396
+ }
13367
13397
 
13368
- return console.debug && (_console5 = console).debug.apply(_console5, arguments) || (_console6 = console).info.apply(_console6, arguments); // eslint-disable-line no-console
13398
+ return (_console6 = console).info.apply(_console6, arguments);
13399
+ /* eslint-enable no-console */
13369
13400
  },
13370
13401
  assert: function () {
13371
13402
  var _console7;
@@ -18351,6 +18382,12 @@ enifed('ember-glimmer/index', ['exports', 'ember-glimmer/helpers/action', 'ember
18351
18382
  return _renderer._resetRenderers;
18352
18383
  }
18353
18384
  });
18385
+ Object.defineProperty(exports, 'renderSettled', {
18386
+ enumerable: true,
18387
+ get: function () {
18388
+ return _renderer.renderSettled;
18389
+ }
18390
+ });
18354
18391
  Object.defineProperty(exports, 'getTemplate', {
18355
18392
  enumerable: true,
18356
18393
  get: function () {
@@ -18687,13 +18724,35 @@ enifed('ember-glimmer/protocol-for-url', ['exports', 'ember-environment', 'node-
18687
18724
  return protocol === null ? ':' : protocol;
18688
18725
  }
18689
18726
  });
18690
- enifed('ember-glimmer/renderer', ['exports', 'ember-babel', '@glimmer/reference', 'ember-debug', 'ember-metal', 'ember-views', 'ember-glimmer/component', 'ember-glimmer/component-managers/outlet', 'ember-glimmer/component-managers/root', 'ember-glimmer/utils/references', '@glimmer/runtime'], function (exports, _emberBabel, _reference, _emberDebug, _emberMetal, _emberViews, _component, _outlet, _root2, _references, _runtime) {
18727
+ enifed('ember-glimmer/renderer', ['exports', 'ember-babel', '@glimmer/reference', 'ember-debug', 'ember-metal', 'ember-views', 'ember-glimmer/component', 'ember-glimmer/component-managers/outlet', 'ember-glimmer/component-managers/root', 'ember-glimmer/utils/references', '@glimmer/runtime', 'rsvp'], function (exports, _emberBabel, _reference, _emberDebug, _emberMetal, _emberViews, _component, _outlet, _root2, _references, _runtime, _rsvp) {
18691
18728
  'use strict';
18692
18729
 
18693
18730
  exports.InteractiveRenderer = exports.InertRenderer = exports.Renderer = exports.DynamicScope = undefined;
18694
18731
  exports._resetRenderers = function () {
18695
18732
  renderers.length = 0;
18696
18733
  };
18734
+ exports.renderSettled =
18735
+ /*
18736
+ Returns a promise which will resolve when rendering has settled. Settled in
18737
+ this context is defined as when all of the tags in use are "current" (e.g.
18738
+ `renderers.every(r => r._isValid())`). When this is checked at the _end_ of
18739
+ the run loop, this essentially guarantees that all rendering is completed.
18740
+
18741
+ @method renderSettled
18742
+ @returns {Promise<void>} a promise which fulfills when rendering has settled
18743
+ */
18744
+ function () {
18745
+ if (renderSettledDeferred === null) {
18746
+ renderSettledDeferred = _rsvp.default.defer();
18747
+ // if there is no current runloop, the promise created above will not have
18748
+ // a chance to resolve (because its resolved in backburner's "end" event)
18749
+ if (!_emberMetal.run.currentRunLoop) {
18750
+ // ensure a runloop has been kicked off
18751
+ backburner.schedule('actions', null, K);
18752
+ }
18753
+ }
18754
+ return renderSettledDeferred.promise;
18755
+ };
18697
18756
  var backburner = _emberMetal.run.backburner;
18698
18757
 
18699
18758
  var DynamicScope = exports.DynamicScope = function () {
@@ -18811,6 +18870,17 @@ enifed('ember-glimmer/renderer', ['exports', 'ember-babel', '@glimmer/reference'
18811
18870
  }
18812
18871
 
18813
18872
  function K() {}
18873
+ var renderSettledDeferred = null;
18874
+ function resolveRenderPromise() {
18875
+ var resolve;
18876
+
18877
+ if (renderSettledDeferred !== null) {
18878
+ resolve = renderSettledDeferred.resolve;
18879
+
18880
+ renderSettledDeferred = null;
18881
+ backburner.join(null, resolve);
18882
+ }
18883
+ }
18814
18884
  var loops = 0;
18815
18885
 
18816
18886
  backburner.on('begin', function () {
@@ -18836,6 +18906,7 @@ enifed('ember-glimmer/renderer', ['exports', 'ember-babel', '@glimmer/reference'
18836
18906
  }
18837
18907
  }
18838
18908
  loops = 0;
18909
+ resolveRenderPromise();
18839
18910
  });
18840
18911
 
18841
18912
  var Renderer = exports.Renderer = function () {
@@ -21210,12 +21281,11 @@ enifed('ember-glimmer/views/outlet', ['exports', 'ember-babel', '@glimmer/refere
21210
21281
 
21211
21282
  exports.default = OutletView;
21212
21283
  });
21213
- enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-debug', 'ember-babel', '@glimmer/reference', 'require', 'backburner', 'ember-console'], function (exports, emberEnvironment, emberUtils, emberDebug, emberBabel, reference, require, Backburner, Logger) {
21284
+ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-debug', 'ember-babel', '@glimmer/reference', 'require', 'backburner'], function (exports, emberEnvironment, emberUtils, emberDebug, emberBabel, reference, require, Backburner) {
21214
21285
  'use strict';
21215
21286
 
21216
21287
  require = require && require.hasOwnProperty('default') ? require['default'] : require;
21217
21288
  Backburner = Backburner && Backburner.hasOwnProperty('default') ? Backburner['default'] : Backburner;
21218
- Logger = Logger && Logger.hasOwnProperty('default') ? Logger['default'] : Logger;
21219
21289
 
21220
21290
  /**
21221
21291
  @module ember
@@ -21963,9 +22033,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
21963
22033
  //
21964
22034
  // This should only be used by the target of the observer
21965
22035
  // while it is setting the observed path.
21966
- function _suspendObserver(obj, path, target, method, callback) {
21967
- return suspendListener(obj, changeEvent(path), target, method, callback);
21968
- }
22036
+
21969
22037
 
21970
22038
  /**
21971
22039
  @method removeBeforeObserver
@@ -22894,7 +22962,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
22894
22962
 
22895
22963
  this._watching = undefined;
22896
22964
  this._mixins = undefined;
22897
- this._bindings = undefined;
22965
+ if (emberEnvironment.ENV._ENABLE_BINDING_SUPPORT) {
22966
+ this._bindings = undefined;
22967
+ }
22898
22968
  this._values = undefined;
22899
22969
  this._deps = undefined;
22900
22970
  this._chainWatchers = undefined;
@@ -23485,32 +23555,20 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
23485
23555
  return key.indexOf('.');
23486
23556
  });
23487
23557
 
23488
- var firstKeyCache = new Cache(1000, function (path) {
23558
+ new Cache(1000, function (path) {
23489
23559
  var index = firstDotIndexCache.get(path);
23490
23560
  return index === -1 ? path : path.slice(0, index);
23491
23561
  });
23492
-
23493
- var tailPathCache = new Cache(1000, function (path) {
23562
+ new Cache(1000, function (path) {
23494
23563
  var index = firstDotIndexCache.get(path);
23495
23564
  return index === -1 ? undefined : path.slice(index + 1);
23496
23565
  });
23497
23566
 
23498
- function isGlobalPath(path) {
23499
- return isGlobalPathCache.get(path);
23500
- }
23501
23567
 
23502
23568
  function isPath(path) {
23503
23569
  return firstDotIndexCache.get(path) !== -1;
23504
23570
  }
23505
23571
 
23506
- function getFirstKey(path) {
23507
- return firstKeyCache.get(path);
23508
- }
23509
-
23510
- function getTailPath(path) {
23511
- return tailPathCache.get(path);
23512
- }
23513
-
23514
23572
  /**
23515
23573
  @module @ember/object
23516
23574
  */
@@ -23716,9 +23774,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
23716
23774
  @param {Object} value The value to set
23717
23775
  @public
23718
23776
  */
23719
- function trySet(root, path, value) {
23720
- return set(root, path, value, true);
23721
- }
23777
+
23722
23778
 
23723
23779
  /**
23724
23780
  @module @ember/object
@@ -26240,462 +26296,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
26240
26296
  */
26241
26297
 
26242
26298
 
26243
- /**
26244
- @module ember
26245
- */
26246
-
26247
- // ..........................................................
26248
- // BINDING
26249
- //
26250
-
26251
- var Binding = function () {
26252
- function Binding(toPath, fromPath) {
26253
-
26254
- // Configuration
26255
- this._from = fromPath;
26256
- this._to = toPath;
26257
- this._oneWay = undefined;
26258
-
26259
- // State
26260
- this._direction = undefined;
26261
- this._readyToSync = undefined;
26262
- this._fromObj = undefined;
26263
- this._fromPath = undefined;
26264
- this._toObj = undefined;
26265
- }
26266
-
26267
- /**
26268
- @class Binding
26269
- @namespace Ember
26270
- @deprecated See https://emberjs.com/deprecations/v2.x#toc_ember-binding
26271
- @public
26272
- */
26273
-
26274
- /**
26275
- This copies the Binding so it can be connected to another object.
26276
- @method copy
26277
- @return {Ember.Binding} `this`
26278
- @public
26279
- */
26280
-
26281
- Binding.prototype.copy = function () {
26282
- var copy = new Binding(this._to, this._from);
26283
- if (this._oneWay) {
26284
- copy._oneWay = true;
26285
- }
26286
- return copy;
26287
- };
26288
-
26289
- // ..........................................................
26290
- // CONFIG
26291
- //
26292
-
26293
- /**
26294
- This will set `from` property path to the specified value. It will not
26295
- attempt to resolve this property path to an actual object until you
26296
- connect the binding.
26297
- The binding will search for the property path starting at the root object
26298
- you pass when you `connect()` the binding. It follows the same rules as
26299
- `get()` - see that method for more information.
26300
- @method from
26301
- @param {String} path The property path to connect to.
26302
- @return {Ember.Binding} `this`
26303
- @public
26304
- */
26305
-
26306
- Binding.prototype.from = function (path) {
26307
- this._from = path;
26308
- return this;
26309
- };
26310
-
26311
- /**
26312
- This will set the `to` property path to the specified value. It will not
26313
- attempt to resolve this property path to an actual object until you
26314
- connect the binding.
26315
- The binding will search for the property path starting at the root object
26316
- you pass when you `connect()` the binding. It follows the same rules as
26317
- `get()` - see that method for more information.
26318
- @method to
26319
- @param {String|Tuple} path A property path or tuple.
26320
- @return {Ember.Binding} `this`
26321
- @public
26322
- */
26323
-
26324
- Binding.prototype.to = function (path) {
26325
- this._to = path;
26326
- return this;
26327
- };
26328
-
26329
- /**
26330
- Configures the binding as one way. A one-way binding will relay changes
26331
- on the `from` side to the `to` side, but not the other way around. This
26332
- means that if you change the `to` side directly, the `from` side may have
26333
- a different value.
26334
- @method oneWay
26335
- @return {Ember.Binding} `this`
26336
- @public
26337
- */
26338
-
26339
- Binding.prototype.oneWay = function () {
26340
- this._oneWay = true;
26341
- return this;
26342
- };
26343
-
26344
- /**
26345
- @method toString
26346
- @return {String} string representation of binding
26347
- @public
26348
- */
26349
-
26350
- Binding.prototype.toString = function () {
26351
- var oneWay = this._oneWay ? '[oneWay]' : '';
26352
- return 'Ember.Binding<' + emberUtils.guidFor(this) + '>(' + this._from + ' -> ' + this._to + ')' + oneWay;
26353
- };
26354
-
26355
- // ..........................................................
26356
- // CONNECT AND SYNC
26357
- //
26358
-
26359
- /**
26360
- Attempts to connect this binding instance so that it can receive and relay
26361
- changes. This method will raise an exception if you have not set the
26362
- from/to properties yet.
26363
- @method connect
26364
- @param {Object} obj The root object for this binding.
26365
- @return {Ember.Binding} `this`
26366
- @public
26367
- */
26368
-
26369
- Binding.prototype.connect = function (obj) {
26370
- var fromObj = void 0,
26371
- fromPath = void 0,
26372
- possibleGlobal = void 0,
26373
- name;
26374
-
26375
- // If the binding's "from" path could be interpreted as a global, verify
26376
- // whether the path refers to a global or not by consulting `Ember.lookup`.
26377
- if (isGlobalPath(this._from)) {
26378
- name = getFirstKey(this._from);
26379
-
26380
- possibleGlobal = emberEnvironment.context.lookup[name];
26381
-
26382
- if (possibleGlobal) {
26383
- fromObj = possibleGlobal;
26384
- fromPath = getTailPath(this._from);
26385
- }
26386
- }
26387
-
26388
- if (fromObj === undefined) {
26389
- fromObj = obj;
26390
- fromPath = this._from;
26391
- }
26392
-
26393
- trySet(obj, this._to, get(fromObj, fromPath));
26394
-
26395
- // Add an observer on the object to be notified when the binding should be updated.
26396
- addObserver(fromObj, fromPath, this, 'fromDidChange');
26397
-
26398
- // If the binding is a two-way binding, also set up an observer on the target.
26399
- if (!this._oneWay) {
26400
- addObserver(obj, this._to, this, 'toDidChange');
26401
- }
26402
-
26403
- addListener(obj, 'willDestroy', this, 'disconnect');
26404
-
26405
- fireDeprecations(obj, this._to, this._from, possibleGlobal, this._oneWay, !possibleGlobal && !this._oneWay);
26406
-
26407
- this._readyToSync = true;
26408
- this._fromObj = fromObj;
26409
- this._fromPath = fromPath;
26410
- this._toObj = obj;
26411
-
26412
- return this;
26413
- };
26414
-
26415
- /**
26416
- Disconnects the binding instance. Changes will no longer be relayed. You
26417
- will not usually need to call this method.
26418
- @method disconnect
26419
- @return {Ember.Binding} `this`
26420
- @public
26421
- */
26422
-
26423
- Binding.prototype.disconnect = function () {
26424
- removeObserver(this._fromObj, this._fromPath, this, 'fromDidChange');
26425
-
26426
- // If the binding is two-way, remove the observer from the target as well.
26427
- if (!this._oneWay) {
26428
- removeObserver(this._toObj, this._to, this, 'toDidChange');
26429
- }
26430
-
26431
- this._readyToSync = false; // Disable scheduled syncs...
26432
- return this;
26433
- };
26434
-
26435
- // ..........................................................
26436
- // PRIVATE
26437
- //
26438
-
26439
- /* Called when the from side changes. */
26440
-
26441
- Binding.prototype.fromDidChange = function () {
26442
- // eslint-disable-line no-unused-vars
26443
- this._scheduleSync('fwd');
26444
- };
26445
-
26446
- /* Called when the to side changes. */
26447
-
26448
- Binding.prototype.toDidChange = function () {
26449
- // eslint-disable-line no-unused-vars
26450
- this._scheduleSync('back');
26451
- };
26452
-
26453
- Binding.prototype._scheduleSync = function (dir) {
26454
- var existingDir = this._direction;
26455
-
26456
- // If we haven't scheduled the binding yet, schedule it.
26457
- if (existingDir === undefined) {
26458
- run.schedule('sync', this, '_sync');
26459
- this._direction = dir;
26460
- }
26461
-
26462
- // If both a 'back' and 'fwd' sync have been scheduled on the same object,
26463
- // default to a 'fwd' sync so that it remains deterministic.
26464
- if (existingDir === 'back' && dir === 'fwd') {
26465
- this._direction = 'fwd';
26466
- }
26467
- };
26468
-
26469
- Binding.prototype._sync = function () {
26470
- var log = emberEnvironment.ENV.LOG_BINDINGS,
26471
- fromValue,
26472
- toValue;
26473
-
26474
- var toObj = this._toObj;
26475
-
26476
- // Don't synchronize destroyed objects or disconnected bindings.
26477
- if (toObj.isDestroyed || !this._readyToSync) {
26478
- return;
26479
- }
26480
-
26481
- // Get the direction of the binding for the object we are
26482
- // synchronizing from.
26483
- var direction = this._direction;
26484
-
26485
- var fromObj = this._fromObj;
26486
- var fromPath = this._fromPath;
26487
-
26488
- this._direction = undefined;
26489
-
26490
- // If we're synchronizing from the remote object...
26491
- if (direction === 'fwd') {
26492
- fromValue = get(fromObj, fromPath);
26493
-
26494
- if (log) {
26495
- Logger.log(' ', this.toString(), '->', fromValue, fromObj);
26496
- }
26497
- if (this._oneWay) {
26498
- trySet(toObj, this._to, fromValue);
26499
- } else {
26500
- _suspendObserver(toObj, this._to, this, 'toDidChange', function () {
26501
- trySet(toObj, this._to, fromValue);
26502
- });
26503
- }
26504
- // If we're synchronizing *to* the remote object.
26505
- } else if (direction === 'back') {
26506
- toValue = get(toObj, this._to);
26507
-
26508
- if (log) {
26509
- Logger.log(' ', this.toString(), '<-', toValue, toObj);
26510
- }
26511
- _suspendObserver(fromObj, fromPath, this, 'fromDidChange', function () {
26512
- trySet(fromObj, fromPath, toValue);
26513
- });
26514
- }
26515
- };
26516
-
26517
- return Binding;
26518
- }();
26519
-
26520
- function fireDeprecations() {}
26521
-
26522
- (function (to, from) {
26523
- for (var key in from) {
26524
- if (from.hasOwnProperty(key)) {
26525
- to[key] = from[key];
26526
- }
26527
- }
26528
- })(Binding, {
26529
-
26530
- /*
26531
- See `Ember.Binding.from`.
26532
- @method from
26533
- @static
26534
- */
26535
- from: function (from) {
26536
- var C = this;
26537
- return new C(undefined, from);
26538
- },
26539
-
26540
- /*
26541
- See `Ember.Binding.to`.
26542
- @method to
26543
- @static
26544
- */
26545
- to: function (to) {
26546
- var C = this;
26547
- return new C(to, undefined);
26548
- }
26549
- });
26550
- /**
26551
- An `Ember.Binding` connects the properties of two objects so that whenever
26552
- the value of one property changes, the other property will be changed also.
26553
-
26554
- ## Automatic Creation of Bindings with `/^*Binding/`-named Properties.
26555
-
26556
- You do not usually create Binding objects directly but instead describe
26557
- bindings in your class or object definition using automatic binding
26558
- detection.
26559
-
26560
- Properties ending in a `Binding` suffix will be converted to `Ember.Binding`
26561
- instances. The value of this property should be a string representing a path
26562
- to another object or a custom binding instance created using Binding helpers
26563
- (see "One Way Bindings"):
26564
-
26565
- ```
26566
- valueBinding: "MyApp.someController.title"
26567
- ```
26568
-
26569
- This will create a binding from `MyApp.someController.title` to the `value`
26570
- property of your object instance automatically. Now the two values will be
26571
- kept in sync.
26572
-
26573
- ## One Way Bindings
26574
-
26575
- One especially useful binding customization you can use is the `oneWay()`
26576
- helper. This helper tells Ember that you are only interested in
26577
- receiving changes on the object you are binding from. For example, if you
26578
- are binding to a preference and you want to be notified if the preference
26579
- has changed, but your object will not be changing the preference itself, you
26580
- could do:
26581
-
26582
- ```
26583
- bigTitlesBinding: Ember.Binding.oneWay("MyApp.preferencesController.bigTitles")
26584
- ```
26585
-
26586
- This way if the value of `MyApp.preferencesController.bigTitles` changes the
26587
- `bigTitles` property of your object will change also. However, if you
26588
- change the value of your `bigTitles` property, it will not update the
26589
- `preferencesController`.
26590
-
26591
- One way bindings are almost twice as fast to setup and twice as fast to
26592
- execute because the binding only has to worry about changes to one side.
26593
-
26594
- You should consider using one way bindings anytime you have an object that
26595
- may be created frequently and you do not intend to change a property; only
26596
- to monitor it for changes (such as in the example above).
26597
-
26598
- ## Adding Bindings Manually
26599
-
26600
- All of the examples above show you how to configure a custom binding, but the
26601
- result of these customizations will be a binding template, not a fully active
26602
- Binding instance. The binding will actually become active only when you
26603
- instantiate the object the binding belongs to. It is useful, however, to
26604
- understand what actually happens when the binding is activated.
26605
-
26606
- For a binding to function it must have at least a `from` property and a `to`
26607
- property. The `from` property path points to the object/key that you want to
26608
- bind from while the `to` path points to the object/key you want to bind to.
26609
-
26610
- When you define a custom binding, you are usually describing the property
26611
- you want to bind from (such as `MyApp.someController.value` in the examples
26612
- above). When your object is created, it will automatically assign the value
26613
- you want to bind `to` based on the name of your binding key. In the
26614
- examples above, during init, Ember objects will effectively call
26615
- something like this on your binding:
26616
-
26617
- ```javascript
26618
- binding = Ember.Binding.from("valueBinding").to("value");
26619
- ```
26620
-
26621
- This creates a new binding instance based on the template you provide, and
26622
- sets the to path to the `value` property of the new object. Now that the
26623
- binding is fully configured with a `from` and a `to`, it simply needs to be
26624
- connected to become active. This is done through the `connect()` method:
26625
-
26626
- ```javascript
26627
- binding.connect(this);
26628
- ```
26629
-
26630
- Note that when you connect a binding you pass the object you want it to be
26631
- connected to. This object will be used as the root for both the from and
26632
- to side of the binding when inspecting relative paths. This allows the
26633
- binding to be automatically inherited by subclassed objects as well.
26634
-
26635
- This also allows you to bind between objects using the paths you declare in
26636
- `from` and `to`:
26637
-
26638
- ```javascript
26639
- // Example 1
26640
- binding = Ember.Binding.from("App.someObject.value").to("value");
26641
- binding.connect(this);
26642
-
26643
- // Example 2
26644
- binding = Ember.Binding.from("parentView.value").to("App.someObject.value");
26645
- binding.connect(this);
26646
- ```
26647
-
26648
- Now that the binding is connected, it will observe both the from and to side
26649
- and relay changes.
26650
-
26651
- If you ever needed to do so (you almost never will, but it is useful to
26652
- understand this anyway), you could manually create an active binding by
26653
- using the `Ember.bind()` helper method. (This is the same method used by
26654
- to setup your bindings on objects):
26655
-
26656
- ```javascript
26657
- Ember.bind(MyApp.anotherObject, "value", "MyApp.someController.value");
26658
- ```
26659
-
26660
- Both of these code fragments have the same effect as doing the most friendly
26661
- form of binding creation like so:
26662
-
26663
- ```javascript
26664
- MyApp.anotherObject = Ember.Object.create({
26665
- valueBinding: "MyApp.someController.value",
26666
-
26667
- // OTHER CODE FOR THIS OBJECT...
26668
- });
26669
- ```
26670
-
26671
- Ember's built in binding creation method makes it easy to automatically
26672
- create bindings for you. You should always use the highest-level APIs
26673
- available, even if you understand how it works underneath.
26674
-
26675
- @class Binding
26676
- @namespace Ember
26677
- @since Ember 0.9
26678
- @public
26679
- */
26680
- // Ember.Binding = Binding; ES6TODO: where to put this?
26681
-
26682
-
26683
- /**
26684
- Global helper method to create a new binding. Just pass the root object
26685
- along with a `to` and `from` path to create and connect the binding.
26686
-
26687
- @method bind
26688
- @for Ember
26689
- @param {Object} obj The root object of the transform.
26690
- @param {String} to The path to the 'to' side of the binding.
26691
- Must be relative to obj.
26692
- @param {String} from The path to the 'from' side of the binding.
26693
- Must be relative to obj or a global path.
26694
- @return {Ember.Binding} binding instance
26695
- @public
26696
- */
26697
-
26698
-
26699
26299
  var a_concat = Array.prototype.concat;
26700
26300
  var isArray = Array.isArray;
26701
26301
 
@@ -26917,43 +26517,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
26917
26517
  }
26918
26518
  }
26919
26519
 
26920
- function detectBinding(key) {
26921
- var length = key.length;
26922
-
26923
- return length > 7 && key.charCodeAt(length - 7) === 66 && key.indexOf('inding', length - 6) !== -1;
26924
- }
26925
- // warm both paths of above function
26926
- detectBinding('notbound');
26927
- detectBinding('fooBinding');
26928
-
26929
- function connectBindings(obj, meta$$1) {
26930
- // TODO Mixin.apply(instance) should disconnect binding if exists
26931
- meta$$1.forEachBindings(function (key, binding) {
26932
- var to;
26933
-
26934
- if (binding) {
26935
- to = key.slice(0, -7); // strip Binding off end
26936
-
26937
- if (binding instanceof Binding) {
26938
- binding = binding.copy(); // copy prototypes' instance
26939
- binding.to(to);
26940
- } else {
26941
- // binding is string path
26942
- binding = new Binding(to, binding);
26943
- }
26944
- binding.connect(obj);
26945
- obj[key] = binding;
26946
- }
26947
- });
26948
- // mark as applied
26949
- meta$$1.clearBindings();
26950
- }
26951
-
26952
- function finishPartial(obj, meta$$1) {
26953
- connectBindings(obj, meta$$1 === undefined ? meta(obj) : meta$$1);
26954
- return obj;
26955
- }
26956
-
26957
26520
  function followAlias(obj, desc, descs, values) {
26958
26521
  var altKey = desc.methodName;
26959
26522
  var value = void 0;
@@ -27046,16 +26609,16 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
27046
26609
  replaceObserversAndListeners(obj, key, obj[key], value);
27047
26610
  }
27048
26611
 
27049
- if (detectBinding(key)) {
26612
+ if (emberEnvironment.ENV._ENABLE_BINDING_SUPPORT && Mixin.detectBinding(key)) {
27050
26613
  meta$$1.writeBindings(key, value);
27051
26614
  }
27052
26615
 
27053
26616
  defineProperty(obj, key, desc, value, meta$$1);
27054
26617
  }
27055
26618
 
27056
- if (!partial) {
26619
+ if (emberEnvironment.ENV._ENABLE_BINDING_SUPPORT && !partial) {
27057
26620
  // don't apply to prototype
27058
- finishPartial(obj, meta$$1);
26621
+ Mixin.finishPartial(obj, meta$$1);
27059
26622
  }
27060
26623
 
27061
26624
  return obj;
@@ -27337,7 +26900,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
27337
26900
  }();
27338
26901
 
27339
26902
  Mixin._apply = applyMixin;
27340
- Mixin.finishPartial = finishPartial;
26903
+ if (emberEnvironment.ENV._ENABLE_BINDING_SUPPORT) {
26904
+ // slotting this so that the legacy addon can add the function here
26905
+ // without triggering an error due to the Object.seal done below
26906
+ Mixin.finishPartial = null;
26907
+ Mixin.detectBinding = null;
26908
+ }
27341
26909
 
27342
26910
  var MixinPrototype = Mixin.prototype;
27343
26911
  MixinPrototype.toString = Object.toString;
@@ -27725,7 +27293,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
27725
27293
  return value;
27726
27294
  };
27727
27295
  exports.set = set;
27728
- exports.trySet = trySet;
27296
+ exports.trySet = function (root, path, value) {
27297
+ return set(root, path, value, true);
27298
+ };
27729
27299
  exports.addListener = addListener;
27730
27300
  exports.hasListeners = function (obj, eventName) {
27731
27301
  var meta$$1 = peekMeta(obj);
@@ -27839,7 +27409,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
27839
27409
  return properties;
27840
27410
  };
27841
27411
  exports.expandProperties = expandProperties;
27842
- exports._suspendObserver = _suspendObserver;
27412
+ exports._suspendObserver = function (obj, path, target, method, callback) {
27413
+ return suspendListener(obj, changeEvent(path), target, method, callback);
27414
+ };
27843
27415
  exports._suspendObservers = function (obj, paths, target, method, callback) {
27844
27416
  var events = paths.map(changeEvent);
27845
27417
  return suspendListeners(obj, events, target, method, callback);
@@ -27923,12 +27495,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
27923
27495
  exports.clearUnprocessedMixins = function () {
27924
27496
  unprocessedFlag = false;
27925
27497
  };
27926
- exports.detectBinding = detectBinding;
27927
- exports.Binding = Binding;
27928
- exports.bind = function (obj, to, from) {
27929
- return new Binding(to, from).connect(obj);
27498
+ exports.isGlobalPath = function (path) {
27499
+ return isGlobalPathCache.get(path);
27930
27500
  };
27931
- exports.isGlobalPath = isGlobalPath;
27932
27501
  exports.InjectedProperty = InjectedProperty;
27933
27502
  exports.setHasViews = function (fn) {
27934
27503
  hasViews = fn;
@@ -32740,6 +32309,10 @@ enifed('ember-runtime/compare', ['exports', 'ember-runtime/utils', 'ember-runtim
32740
32309
  return (diff > 0) - (diff < 0);
32741
32310
  }
32742
32311
 
32312
+ /**
32313
+ @module @ember/utils
32314
+ */
32315
+
32743
32316
  /**
32744
32317
  Compares two javascript values and returns:
32745
32318
 
@@ -32775,7 +32348,8 @@ enifed('ember-runtime/compare', ['exports', 'ember-runtime/utils', 'ember-runtim
32775
32348
  ```
32776
32349
 
32777
32350
  @method compare
32778
- @for Ember
32351
+ @for @ember/utils
32352
+ @static
32779
32353
  @param {Object} v First value to compare
32780
32354
  @param {Object} w Second value to compare
32781
32355
  @return {Number} -1 if v < w, 0 if v = w and 1 if v > w.
@@ -34199,11 +33773,11 @@ enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-debug
34199
33773
  ```javascript
34200
33774
  let ToDoList = Ember.Object.extend({
34201
33775
  // using standard ascending sort
34202
- todosSorting: ['name'],
33776
+ todosSorting: Object.freeze(['name']),
34203
33777
  sortedTodos: Ember.computed.sort('todos', 'todosSorting'),
34204
33778
 
34205
33779
  // using descending sort
34206
- todosSortingDesc: ['name:desc'],
33780
+ todosSortingDesc: Object.freeze(['name:desc']),
34207
33781
  sortedTodosDesc: Ember.computed.sort('todos', 'todosSortingDesc'),
34208
33782
 
34209
33783
  // using a custom sort function
@@ -35440,6 +35014,9 @@ enifed('ember-runtime/is-equal', ['exports'], function (exports) {
35440
35014
  'use strict';
35441
35015
 
35442
35016
  exports.default =
35017
+ /**
35018
+ @module @ember/utils
35019
+ */
35443
35020
  /**
35444
35021
  Compares two objects, returning true if they are equal.
35445
35022
 
@@ -35472,7 +35049,8 @@ enifed('ember-runtime/is-equal', ['exports'], function (exports) {
35472
35049
  ```
35473
35050
 
35474
35051
  @method isEqual
35475
- @for Ember
35052
+ @for @ember/utils
35053
+ @static
35476
35054
  @param {Object} a first object to compare
35477
35055
  @param {Object} b second object to compare
35478
35056
  @return {Boolean}
@@ -38675,7 +38253,6 @@ enifed('ember-runtime/system/core_object', ['exports', 'ember-utils', 'ember-met
38675
38253
 
38676
38254
  var schedule = _emberMetal.run.schedule;
38677
38255
  var applyMixin = _emberMetal.Mixin._apply;
38678
- var finishPartial = _emberMetal.Mixin.finishPartial;
38679
38256
  var reopen = _emberMetal.Mixin.prototype.reopen;
38680
38257
 
38681
38258
  var POST_INIT = exports.POST_INIT = (0, _emberUtils.symbol)('POST_INIT');
@@ -38754,7 +38331,7 @@ enifed('ember-runtime/system/core_object', ['exports', 'ember-utils', 'ember-met
38754
38331
  value = properties[keyName];
38755
38332
 
38756
38333
 
38757
- if ((0, _emberMetal.detectBinding)(keyName)) {
38334
+ if (_emberEnvironment.ENV._ENABLE_BINDING_SUPPORT && _emberMetal.Mixin.detectBinding(keyName)) {
38758
38335
  m.writeBindings(keyName, value);
38759
38336
  }
38760
38337
 
@@ -38794,7 +38371,9 @@ enifed('ember-runtime/system/core_object', ['exports', 'ember-utils', 'ember-met
38794
38371
  }
38795
38372
  }
38796
38373
 
38797
- finishPartial(this, m);
38374
+ if (_emberEnvironment.ENV._ENABLE_BINDING_SUPPORT) {
38375
+ _emberMetal.Mixin.finishPartial(this, m);
38376
+ }
38798
38377
 
38799
38378
  this.init.apply(this, arguments);
38800
38379
 
@@ -40488,6 +40067,10 @@ enifed('ember-utils', ['exports'], function (exports) {
40488
40067
  return obj !== null && obj !== undefined && typeof obj[methodName] === 'function';
40489
40068
  }
40490
40069
 
40070
+ /**
40071
+ @module @ember/utils
40072
+ */
40073
+
40491
40074
  /**
40492
40075
  Checks to see if the `methodName` exists on the `obj`,
40493
40076
  and if it does, invokes it with the arguments passed.
@@ -40501,7 +40084,8 @@ enifed('ember-utils', ['exports'], function (exports) {
40501
40084
  ```
40502
40085
 
40503
40086
  @method tryInvoke
40504
- @for Ember
40087
+ @for @ember/utils
40088
+ @static
40505
40089
  @param {Object} obj The object to check for the method
40506
40090
  @param {String} methodName The method name to check for
40507
40091
  @param {Array} [args] The arguments to pass to the method
@@ -43182,7 +42766,7 @@ enifed('ember/index', ['exports', 'require', 'ember-environment', 'node-module',
43182
42766
  enifed("ember/version", ["exports"], function (exports) {
43183
42767
  "use strict";
43184
42768
 
43185
- exports.default = "3.0.0-beta.1";
42769
+ exports.default = "3.0.0-beta.2";
43186
42770
  });
43187
42771
  /*global enifed */
43188
42772
  enifed('node-module', ['exports'], function(_exports) {