dist/ember-template-compiler.js in ember-source-2.15.3 vs dist/ember-template-compiler.js in ember-source-2.16.0.beta.1

- old
+ new

@@ -4,11 +4,11 @@ * @copyright Copyright 2011-2017 Tilde Inc. and contributors * Portions Copyright 2006-2011 Strobe Inc. * Portions Copyright 2008-2011 Apple Inc. All rights reserved. * @license Licensed under MIT license * See https://raw.github.com/emberjs/ember.js/master/LICENSE - * @version 2.15.3 + * @version 2.16.0-beta.1 */ var enifed, requireModule, Ember; var mainContext = this; // Used in ember-environment/lib/global.js @@ -4638,10 +4638,11 @@ this.targetQueues = Object.create(null); this.index = 0; this.name = name; this.options = options; this.globalOptions = globalOptions; + this.globalOptions.onError = getOnError(globalOptions); } Queue.prototype.push = function (target, method, args, stack) { this._queue.push(target, method, args, stack); return { @@ -4667,17 +4668,18 @@ Queue.prototype.flush = function (sync) { var _options = this.options, before = _options.before, after = _options.after, - onError, i; var target = void 0; var method = void 0; var args = void 0; var errorRecordedForStack = void 0; + var onError = this.globalOptions.onError; + var invoke = onError ? this.invokeWithOnError : this.invoke; this.targetQueues = Object.create(null); var queueItems = void 0; if (this._queueBeingFlushed.length > 0) { queueItems = this._queueBeingFlushed; } else { @@ -4685,44 +4687,38 @@ this._queue = []; } if (before) { before(); } - var invoke = void 0; - if (queueItems.length > 0) { - onError = getOnError(this.globalOptions); - - invoke = onError ? this.invokeWithOnError : this.invoke; - for (i = this.index; i < queueItems.length; i += 4) { - this.index += 4; - target = queueItems[i]; - method = queueItems[i + 1]; - args = queueItems[i + 2]; - errorRecordedForStack = queueItems[i + 3]; // Debugging assistance - // method could have been nullified / canceled during flush - if (method !== null) { - // - // ** Attention intrepid developer ** - // - // To find out the stack of this task when it was scheduled onto - // the run loop, add the following to your app.js: - // - // Ember.run.backburner.DEBUG = true; // NOTE: This slows your app, don't leave it on in production. - // - // Once that is in place, when you are at a breakpoint and navigate - // here in the stack explorer, you can look at `errorRecordedForStack.stack`, - // which will be the captured stack when this job was scheduled. - // - // One possible long-term solution is the following Chrome issue: - // https://bugs.chromium.org/p/chromium/issues/detail?id=332624 - // - invoke(target, method, args, onError, errorRecordedForStack); - } - if (this.index !== this._queueBeingFlushed.length && this.globalOptions.mustYield && this.globalOptions.mustYield()) { - return 1 /* Pause */; - } + for (i = this.index; i < queueItems.length; i += 4) { + this.index += 4; + target = queueItems[i]; + method = queueItems[i + 1]; + args = queueItems[i + 2]; + errorRecordedForStack = queueItems[i + 3]; // Debugging assistance + // method could have been nullified / canceled during flush + if (method !== null) { + // + // ** Attention intrepid developer ** + // + // To find out the stack of this task when it was scheduled onto + // the run loop, add the following to your app.js: + // + // Ember.run.backburner.DEBUG = true; // NOTE: This slows your app, don't leave it on in production. + // + // Once that is in place, when you are at a breakpoint and navigate + // here in the stack explorer, you can look at `errorRecordedForStack.stack`, + // which will be the captured stack when this job was scheduled. + // + // One possible long-term solution is the following Chrome issue: + // https://bugs.chromium.org/p/chromium/issues/detail?id=332624 + // + invoke(target, method, args, onError, errorRecordedForStack); } + if (this.index !== this._queueBeingFlushed.length && this.globalOptions.mustYield && this.globalOptions.mustYield()) { + return 1 /* Pause */; + } } if (after) { after(); } this._queueBeingFlushed.length = 0; @@ -4928,21 +4924,22 @@ return DeferredActionQueues; }(); // accepts a function that when invoked will return an iterator // iterator will drain until completion + // accepts a function that when invoked will return an iterator var iteratorDrain = function (fn) { var iterator = fn(); var result = iterator.next(); while (result.done === false) { result.value(); result = iterator.next(); } }; + var now = Date.now; var noop = function () {}; - var SET_TIMEOUT = setTimeout; var Backburner = function () { function Backburner(queueNames) { var _this = this; @@ -4975,16 +4972,13 @@ }; platform.clearTimeout = _platform.clearTimeout || function (id) { return clearTimeout(id); }; platform.next = _platform.next || function (fn) { - return SET_TIMEOUT(fn, 0); + return platform.setTimeout(fn, 0); }; platform.clearNext = _platform.clearNext || platform.clearTimeout; - platform.now = _platform.now || function () { - return Date.now(); - }; this._platform = platform; this._boundRunExpiredTimers = function () { _this._runExpiredTimers(); }; this._boundAutorunEnd = function () { @@ -5279,11 +5273,11 @@ } else { method = args.shift(); } } var onError = getOnError(this.options); - var executeAt = this._platform.now() + wait; + var executeAt = now() + wait; var fn = void 0; if (onError) { fn = function () { try { method.apply(target, args); @@ -5499,11 +5493,11 @@ executeAt, fn; var l = timers.length; var i = 0; var defaultQueue = this.options.defaultQueue; - var n = this._platform.now(); + var n = now(); for (; i < l; i += 2) { executeAt = timers[i]; if (executeAt <= n) { fn = timers[i + 1]; @@ -5533,11 +5527,11 @@ Backburner.prototype._installTimerTimeout = function () { if (this._timers.length === 0) { return; } var minExpiresAt = this._timers[0]; - var n = this._platform.now(); + var n = now(); var wait = Math.max(0, minExpiresAt - n); this._timerTimeoutId = this._platform.setTimeout(this._boundRunExpiredTimers, wait); }; Backburner.prototype._ensureInstance = function () { @@ -5628,39 +5622,32 @@ if (options.source) { expandedFullName = this.registry.expandLocalLookup(fullName, options); // if expandLocalLookup returns falsey, we do not support local lookup - if (_features.EMBER_MODULE_UNIFICATION) { - if (expandedFullName) { - // with ember-module-unification, if expandLocalLookup returns something, - // pass it to the resolve without the source - normalizedName = expandedFullName; - options = {}; - } - } else { + if (!_features.EMBER_MODULE_UNIFICATION) { if (!expandedFullName) { return; } normalizedName = expandedFullName; + } else if (expandedFullName) { + // with ember-module-unification, if expandLocalLookup returns something, + // pass it to the resolve without the source + normalizedName = expandedFullName; + options = {}; } } var cacheKey = this._resolverCacheKey(normalizedName, options); var cached = this.factoryManagerCache[cacheKey]; if (cached !== undefined) { return cached; } - var factory = void 0; - if (_features.EMBER_MODULE_UNIFICATION) { - factory = this.registry.resolve(normalizedName, options); - } else { - factory = this.registry.resolve(normalizedName); - } + var factory = _features.EMBER_MODULE_UNIFICATION ? this.registry.resolve(normalizedName, options) : this.registry.resolve(normalizedName); if (factory === undefined) { return; } @@ -5725,24 +5712,22 @@ if (options.source) { expandedFullName = container.registry.expandLocalLookup(fullName, options); - if (_features.EMBER_MODULE_UNIFICATION) { - if (expandedFullName) { - // with ember-module-unification, if expandLocalLookup returns something, - // pass it to the resolve without the source - fullName = expandedFullName; - options = {}; - } - } else { + if (!_features.EMBER_MODULE_UNIFICATION) { // if expandLocalLookup returns falsey, we do not support local lookup if (!expandedFullName) { return; } fullName = expandedFullName; + } else if (expandedFullName) { + // with ember-module-unification, if expandLocalLookup returns something, + // pass it to the resolve without the source + fullName = expandedFullName; + options = {}; } } var cacheKey = container._resolverCacheKey(fullName, options); var cached = container.cache[cacheKey]; @@ -5780,22 +5765,12 @@ return instantiate !== false && (singleton !== false || isSingleton(container, fullName)) && isInstantiatable(container, fullName); } function instantiateFactory(container, fullName, options) { + var factoryManager = _features.EMBER_MODULE_UNIFICATION && options && options.source ? container.factoryFor(fullName, options) : container.factoryFor(fullName); - var factoryManager = void 0; - if (_features.EMBER_MODULE_UNIFICATION) { - if (options && options.source) { - factoryManager = container.factoryFor(fullName, options); - } else { - factoryManager = container.factoryFor(fullName); - } - } else { - factoryManager = container.factoryFor(fullName); - } - if (factoryManager === undefined) { return; } var cacheKey = container._resolverCacheKey(fullName, options); @@ -6317,15 +6292,15 @@ injections = injections.concat(this.fallback.getTypeInjections(type)); } return injections; }, resolverCacheKey: function (name, options) { - if (_features.EMBER_MODULE_UNIFICATION) { - return options && options.source ? options.source + ':' + name : name; - } else { + if (!_features.EMBER_MODULE_UNIFICATION) { return name; } + + return options && options.source ? options.source + ':' + name : name; } }; function deprecateResolverFunction(registry) { true && !false && (0, _emberDebug.deprecate)('Passing a `resolver` function into a Registry is deprecated. Please pass in a Resolver object with a `resolve` method.', false, { id: 'ember-application.registry-resolver-as-function', until: '3.0.0', url: 'https://emberjs.com/deprecations/v2.x#toc_registry-resolver-as-function' }); @@ -6411,25 +6386,23 @@ if (options && options.source) { // when `source` is provided expand normalizedName // and source into the full normalizedName expandedNormalizedName = registry.expandLocalLookup(normalizedName, options); + // if expandLocalLookup returns falsey, we do not support local lookup - if (_features.EMBER_MODULE_UNIFICATION) { - if (expandedNormalizedName) { - // with ember-module-unification, if expandLocalLookup returns something, - // pass it to the resolve without the source - normalizedName = expandedNormalizedName; - options = {}; - } - } else { - // if expandLocalLookup returns falsey, we do not support local lookup + if (!_features.EMBER_MODULE_UNIFICATION) { if (!expandedNormalizedName) { return; } normalizedName = expandedNormalizedName; + } else if (expandedNormalizedName) { + // with ember-module-unification, if expandLocalLookup returns something, + // pass it to the resolve without the source + normalizedName = expandedNormalizedName; + options = {}; } } var cacheKey = registry.resolverCacheKey(normalizedName, options), expandedNormalizedName; @@ -7857,57 +7830,10 @@ } } */ - function indexOf(array, target, method) { - var index = -1, - i; - // hashes are added to the end of the event array - // so it makes sense to start searching at the end - // of the array and search in reverse - for (i = array.length - 3; i >= 0; i -= 3) { - if (target === array[i] && method === array[i + 1]) { - index = i; - break; - } - } - return index; - } - - function accumulateListeners(obj, eventName, otherActions) { - var meta$$1 = exports.peekMeta(obj), - i, - target, - method, - flags, - actionIndex; - if (!meta$$1) { - return; - } - var actions = meta$$1.matchingListeners(eventName); - if (actions === undefined) { - return; - } - var newActions = []; - - for (i = actions.length - 3; i >= 0; i -= 3) { - target = actions[i]; - method = actions[i + 1]; - flags = actions[i + 2]; - actionIndex = indexOf(otherActions, target, method); - - - if (actionIndex === -1) { - otherActions.push(target, method, flags); - newActions.push(target, method, flags); - } - } - - return newActions; - } - /** Add an event listener @method addListener @for Ember @@ -8183,26 +8109,26 @@ if (propertyTag !== undefined) { propertyTag.dirty(); } if (propertyKey === 'content' && meta$$1.isProxy()) { - meta$$1.getTag().contentDidChange(); + objectTag.contentDidChange(); } if (objectTag !== undefined || propertyTag !== undefined) { ensureRunloop(); } } - var run = void 0; + var backburner = void 0; function ensureRunloop() { - if (run === undefined) { - run = require('ember-metal').run; + if (backburner === undefined) { + backburner = require('ember-metal').run.backburner; } if (hasViews()) { - run.backburner.ensureInstance(); + backburner.ensureInstance(); } } /* this.observerSet = { @@ -8232,16 +8158,16 @@ ObserverSet.prototype.add = function (sender, keyName, eventName) { var observerSet = this.observerSet; var observers = this.observers; var senderGuid = emberUtils.guidFor(sender); var keySet = observerSet[senderGuid]; - var index = void 0; - if (!keySet) { + if (keySet === undefined) { observerSet[senderGuid] = keySet = {}; } - index = keySet[keyName]; + + var index = keySet[keyName]; if (index === undefined) { index = observers.push({ sender: sender, keyName: keyName, eventName: eventName, @@ -8251,13 +8177,13 @@ } return observers[index].listeners; }; ObserverSet.prototype.flush = function () { - var observers = this.observers; - var i = void 0, - observer = void 0, + var observers = this.observers, + i; + var observer = void 0, sender = void 0; this.clear(); for (i = 0; i < observers.length; ++i) { observer = observers[i]; sender = observer.sender; @@ -8405,11 +8331,10 @@ @return {void} @private */ function propertyWillChange(obj, keyName, _meta) { var meta$$1 = _meta || exports.peekMeta(obj); - if (meta$$1 && !meta$$1.isInitialized(obj)) { return; } var watching = meta$$1 && meta$$1.peekWatching(keyName) > 0; @@ -8459,15 +8384,12 @@ if (isDescriptor && possibleDesc.didChange) { possibleDesc.didChange(obj, keyName); } if (hasMeta && meta$$1.peekWatching(keyName) > 0) { - if (meta$$1.hasDeps(keyName) && !meta$$1.isSourceDestroying()) { - dependentKeysDidChange(obj, keyName, meta$$1); - } - - chainsDidChange(obj, keyName, meta$$1, false); + dependentKeysDidChange(obj, keyName, meta$$1); + chainsDidChange(obj, keyName, meta$$1); notifyObservers(obj, keyName, meta$$1); } if (obj[PROPERTY_DID_CHANGE]) { obj[PROPERTY_DID_CHANGE](keyName); @@ -8487,34 +8409,32 @@ var WILL_SEEN = void 0; var DID_SEEN = void 0; // called whenever a property is about to change to clear the cache of any dependent keys (and notify those properties of changes, etc...) function dependentKeysWillChange(obj, depKey, meta$$1) { - var seen, top; - - if (meta$$1.isSourceDestroying()) { + if (meta$$1.isSourceDestroying() || !meta$$1.hasDeps(depKey)) { return; } - if (meta$$1.hasDeps(depKey)) { - seen = WILL_SEEN; - top = !seen; + var seen = WILL_SEEN; + var top = !seen; + if (top) { + seen = WILL_SEEN = {}; + } - if (top) { - seen = WILL_SEEN = {}; - } + iterDeps(propertyWillChange, obj, depKey, seen, meta$$1); - iterDeps(propertyWillChange, obj, depKey, seen, meta$$1); - - if (top) { - WILL_SEEN = null; - } + if (top) { + WILL_SEEN = null; } } // called whenever a property has just changed to update dependent keys function dependentKeysDidChange(obj, depKey, meta$$1) { + if (meta$$1.isSourceDestroying() || !meta$$1.hasDeps(depKey)) { + return; + } var seen = DID_SEEN; var top = !seen; if (top) { seen = DID_SEEN = {}; @@ -8559,25 +8479,25 @@ }); } function chainsWillChange(obj, keyName, meta$$1) { var chainWatchers = meta$$1.readableChainWatchers(); - if (chainWatchers) { + if (chainWatchers !== undefined) { chainWatchers.notify(keyName, false, propertyWillChange); } } function chainsDidChange(obj, keyName, meta$$1) { var chainWatchers = meta$$1.readableChainWatchers(); - if (chainWatchers) { + if (chainWatchers !== undefined) { chainWatchers.notify(keyName, true, propertyDidChange); } } function overrideChains(obj, keyName, meta$$1) { var chainWatchers = meta$$1.readableChainWatchers(); - if (chainWatchers) { + if (chainWatchers !== undefined) { chainWatchers.revalidate(keyName); } } /** @@ -8620,41 +8540,82 @@ function changeProperties(callback, binding) { beginPropertyChanges(); try { callback.call(binding); } finally { - endPropertyChanges.call(binding); + endPropertyChanges(); } } + function indexOf(array, target, method) { + var index = -1, + i; + // hashes are added to the end of the event array + // so it makes sense to start searching at the end + // of the array and search in reverse + for (i = array.length - 3; i >= 0; i -= 3) { + if (target === array[i] && method === array[i + 1]) { + index = i; + break; + } + } + return index; + } + + function accumulateListeners(obj, eventName, otherActions, meta$$1) { + var actions = meta$$1.matchingListeners(eventName), + i, + target, + method, + flags, + actionIndex; + if (actions === undefined) { + return; + } + var newActions = []; + + for (i = actions.length - 3; i >= 0; i -= 3) { + target = actions[i]; + method = actions[i + 1]; + flags = actions[i + 2]; + actionIndex = indexOf(otherActions, target, method); + + + if (actionIndex === -1) { + otherActions.push(target, method, flags); + newActions.push(target, method, flags); + } + } + + return newActions; + } + function notifyBeforeObservers(obj, keyName, meta$$1) { if (meta$$1.isSourceDestroying()) { return; } var eventName = keyName + ':before'; var listeners = void 0, added = void 0; - if (deferred) { + if (deferred > 0) { listeners = beforeObserverSet.add(obj, keyName, eventName); - added = accumulateListeners(obj, eventName, listeners); - sendEvent(obj, eventName, [obj, keyName], added); - } else { - sendEvent(obj, eventName, [obj, keyName]); + added = accumulateListeners(obj, eventName, listeners, meta$$1); } + sendEvent(obj, eventName, [obj, keyName], added); } function notifyObservers(obj, keyName, meta$$1) { if (meta$$1.isSourceDestroying()) { return; } var eventName = keyName + ':change'; var listeners = void 0; - if (deferred) { + if (deferred > 0) { listeners = observerSet.add(obj, keyName, eventName); - accumulateListeners(obj, eventName, listeners); + accumulateListeners(obj, eventName, listeners, meta$$1); } else { sendEvent(obj, eventName, [obj, keyName]); } } @@ -8712,19 +8673,24 @@ } function DEFAULT_GETTER_FUNCTION(name) { return function () { var meta$$1 = exports.peekMeta(this); - return meta$$1 && meta$$1.peekValues(name); + if (meta$$1 !== null && meta$$1 !== undefined) { + return meta$$1.peekValues(name); + } }; } function INHERITING_GETTER_FUNCTION(name) { function IGETTER_FUNCTION() { var meta$$1 = exports.peekMeta(this), proto; - var val = meta$$1 && meta$$1.readInheritedValue('values', name); + var val = void 0; + if (meta$$1 !== null && meta$$1 !== undefined) { + val = meta$$1.readInheritedValue('values', name); + } if (val === UNDEFINED) { proto = Object.getPrototypeOf(this); return proto && proto[name]; @@ -8781,11 +8747,11 @@ You must provide this or `data` but not both. @param {*} [data] something other than a descriptor, that will become the explicit value of this property. */ function defineProperty(obj, keyName, desc, data, meta$$1) { - if (!meta$$1) { + if (meta$$1 === null || meta$$1 === undefined) { meta$$1 = meta(obj); } var watchEntry = meta$$1.peekWatching(keyName), defaultDescriptor; @@ -9036,17 +9002,10 @@ } else if (count > 1) { meta$$1.writeWatching(keyName, count - 1); } } - // get the chains for the current object. If the current object has - // chains inherited from the proto they will be cloned and reconfigured for - // the current object. - function chainsFor(obj, meta$$1) { - return (meta$$1 || meta(obj)).writableChains(makeChainNode); - } - function makeChainNode(obj) { return new ChainNode(null, null, obj); } function watchPath(obj, keyPath, meta$$1) { @@ -9057,11 +9016,11 @@ var counter = m.peekWatching(keyPath) || 0; m.writeWatching(keyPath, counter + 1); if (counter === 0) { // activate watching first time - chainsFor(obj, m).add(keyPath); + m.writableChains(makeChainNode).add(keyPath); } } function unwatchPath(obj, keyPath, meta$$1) { if (typeof obj !== 'object' || obj === null) { @@ -9073,11 +9032,11 @@ } var counter = m.peekWatching(keyPath) || 0; if (counter === 1) { m.writeWatching(keyPath, 0); - chainsFor(obj, m).remove(keyPath); + m.readableChains().remove(keyPath); } else if (counter > 1) { m.writeWatching(keyPath, counter - 1); } } @@ -9280,20 +9239,20 @@ // copies a top level object only ChainNode.prototype.copy = function (obj) { - var ret = new ChainNode(null, null, obj); + var ret = new ChainNode(null, null, obj), + path; var paths = this._paths; - var path = void 0; if (paths !== undefined) { + path = void 0; + for (path in paths) { - // this check will also catch non-number vals. - if (paths[path] <= 0) { - continue; + if (paths[path] > 0) { + ret.add(path); } - ret.add(path); } } return ret; }; @@ -9393,13 +9352,15 @@ this._value = undefined; } // then notify chains... var chains = this._chains, - parentValue; - var node = void 0; + parentValue, + node; if (chains !== undefined) { + node = void 0; + for (var key in chains) { node = chains[key]; if (node !== undefined) { node.notify(revalidate, affected); } @@ -9416,14 +9377,12 @@ path = this._key + '.' + path; } if (this._parent) { this._parent.populateAffected(path, depth + 1, affected); - } else { - if (depth > 1) { - affected.push(this.value(), path); - } + } else if (depth > 1) { + affected.push(this.value(), path); } }; return ChainNode; }(); @@ -9534,18 +9493,10 @@ Meta.prototype.isInitialized = function (obj) { return this.proto !== obj; }; - Meta.prototype.setTag = function (tag) { - this._tag = tag; - }; - - Meta.prototype.getTag = function () { - return this._tag; - }; - Meta.prototype.destroy = function () { if (this.isMetaDestroyed()) { return; } @@ -9553,29 +9504,29 @@ var nodes = void 0, key = void 0, nodeObject = void 0, foreignMeta; var node = this.readableChains(); - if (node) { + if (node !== undefined) { NODE_STACK.push(node); // process tree while (NODE_STACK.length > 0) { node = NODE_STACK.pop(); // push children nodes = node._chains; - if (nodes) { + if (nodes !== undefined) { for (key in nodes) { if (nodes[key] !== undefined) { NODE_STACK.push(nodes[key]); } } } // remove chainWatcher in node object if (node._watching) { nodeObject = node._object; - if (nodeObject) { + if (nodeObject !== undefined) { foreignMeta = exports.peekMeta(nodeObject); // avoid cleaning up chain watchers when both current and // foreign objects are being destroyed // if both are being destroyed manual cleanup is not needed // as they will be GC'ed and no non-destroyed references will @@ -9804,25 +9755,26 @@ Meta.prototype.writableChains = function (create) { true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot create a new chains for `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed()); var ret = this._chains; if (ret === undefined) { - if (this.parent) { - ret = this._chains = this.parent.writableChains(create).copy(this.source); + if (this.parent === undefined) { + ret = create(this.source); } else { - ret = this._chains = create(this.source); + ret = this.parent.writableChains(create).copy(this.source); } + this._chains = ret; } return ret; }; Meta.prototype.readableChains = function () { return this._getInherited('_chains'); }; Meta.prototype.writeWatching = function (subkey, value) { - true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot update watchers for `hello` on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed()); + true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot update watchers for `' + subkey + '` on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed()); var map = this._getOrCreateOwnMap('_watching'); map[subkey] = value; }; @@ -10029,11 +9981,11 @@ return meta; } pointer = getPrototypeOf(pointer); { - counters.peakPrototypeWalks++; + counters.peekPrototypeWalks++; } } }; } else { setMeta = function (obj, meta) { @@ -10049,21 +10001,10 @@ exports.peekMeta = function (obj) { return obj[META_FIELD]; }; } - function deleteMeta(obj) { - { - counters.deleteCalls++; - } - - var meta = exports.peekMeta(obj); - if (meta !== undefined) { - meta.destroy(); - } - } - /** Retrieves the meta hash for an object. If `writable` is true ensures the hash is writable for this object as well. The meta object contains information about computed property descriptors as @@ -10177,50 +10118,33 @@ }; return DefaultStore; }(); - var IS_GLOBAL = /^[A-Z$]/; var IS_GLOBAL_PATH = /^[A-Z$].*[\.]/; - new Cache(1000, function (key) { - return IS_GLOBAL.test(key); - }); var isGlobalPathCache = new Cache(1000, function (key) { return IS_GLOBAL_PATH.test(key); }); - var hasThisCache = new Cache(1000, function (key) { - return key.lastIndexOf('this.', 0) === 0; - }); var firstDotIndexCache = new Cache(1000, function (key) { return key.indexOf('.'); }); var firstKeyCache = new Cache(1000, function (path) { var index = firstDotIndexCache.get(path); - if (index === -1) { - return path; - } else { - return path.slice(0, index); - } + return index === -1 ? path : path.slice(0, index); }); var tailPathCache = new Cache(1000, function (path) { var index = firstDotIndexCache.get(path); - if (index !== -1) { - return path.slice(index + 1); - } + return index === -1 ? undefined : path.slice(index + 1); }); function isGlobalPath(path) { return isGlobalPathCache.get(path); } - function hasThis(path) { - return hasThisCache.get(path); - } - function isPath(path) { return firstDotIndexCache.get(path) !== -1; } function getFirstKey(path) { @@ -10279,21 +10203,21 @@ */ function get(obj, keyName) { true && !(arguments.length === 2) && emberDebug.assert('Get must be called with two arguments; an object and a property key', arguments.length === 2); true && !(obj !== undefined && obj !== null) && emberDebug.assert('Cannot call get with \'' + keyName + '\' on an undefined object.', obj !== undefined && obj !== null); true && !(typeof keyName === 'string') && emberDebug.assert('The key provided to get must be a string, you passed ' + keyName, typeof keyName === 'string'); - true && !!hasThis(keyName) && emberDebug.assert('\'this\' in paths is not supported', !hasThis(keyName)); + true && !(keyName.lastIndexOf('this.', 0) !== 0) && emberDebug.assert('\'this\' in paths is not supported', keyName.lastIndexOf('this.', 0) !== 0); true && !(keyName !== '') && emberDebug.assert('Cannot call `Ember.get` with an empty string', keyName !== ''); var value = obj[keyName]; var isDescriptor = value !== null && typeof value === 'object' && value.isDescriptor; if (isDescriptor) { return value.get(obj, keyName); } else if (isPath(keyName)) { return _getPath(obj, keyName); - } else if (value === undefined && 'object' === typeof obj && !(keyName in obj) && 'function' === typeof obj.unknownProperty) { + } else if (value === undefined && 'object' === typeof obj && !(keyName in obj) && typeof obj.unknownProperty === 'function') { return obj.unknownProperty(keyName); } else { return value; } } @@ -10360,11 +10284,11 @@ */ function set(obj, keyName, value, tolerant) { true && !(arguments.length === 3 || arguments.length === 4) && emberDebug.assert('Set must be called with three or four arguments; an object, a property key, a value and tolerant true/false', arguments.length === 3 || arguments.length === 4); true && !(obj && typeof obj === 'object' || typeof obj === 'function') && emberDebug.assert('Cannot call set with \'' + keyName + '\' on an undefined object.', obj && typeof obj === 'object' || typeof obj === 'function'); true && !(typeof keyName === 'string') && emberDebug.assert('The key provided to set must be a string, you passed ' + keyName, typeof keyName === 'string'); - true && !!hasThis(keyName) && emberDebug.assert('\'this\' in paths is not supported', !hasThis(keyName)); + true && !(keyName.lastIndexOf('this.', 0) !== 0) && emberDebug.assert('\'this\' in paths is not supported', keyName.lastIndexOf('this.', 0) !== 0); true && !!obj.isDestroyed && emberDebug.assert('calling set on destroyed object: ' + emberUtils.toString(obj) + '.' + keyName + ' = ' + emberUtils.toString(value), !obj.isDestroyed); if (isPath(keyName)) { return setPath(obj, keyName, value, tolerant); } @@ -10374,14 +10298,12 @@ var isDescriptor = currentValue !== null && typeof currentValue === 'object' && currentValue.isDescriptor; if (isDescriptor) { /* computed property */ currentValue.set(obj, keyName, value); - } else if (obj.setUnknownProperty && currentValue === undefined && !(keyName in obj)) { + } else if (currentValue === undefined && 'object' === typeof obj && !(keyName in obj) && typeof obj.setUnknownProperty === 'function') { /* unknown property */ - true && !(typeof obj.setUnknownProperty === 'function') && emberDebug.assert('setUnknownProperty must be a function', typeof obj.setUnknownProperty === 'function'); - obj.setUnknownProperty(keyName, value); } else if (!(currentValue === value)) { meta$$1 = exports.peekMeta(obj); propertyWillChange(obj, keyName, meta$$1); @@ -10416,35 +10338,24 @@ } }; } function setPath(root, path, value, tolerant) { - // get the last part of the path - var keyName = path.slice(path.lastIndexOf('.') + 1); + var parts = path.split('.'); + var keyName = parts.pop(); - // get the first part of the part - path = path === keyName ? keyName : path.slice(0, path.length - (keyName.length + 1)); + true && !(keyName.trim().length > 0) && emberDebug.assert('Property set failed: You passed an empty path', keyName.trim().length > 0); - // unless the path is this, look up the first part to - // get the root - if (path !== 'this') { - root = _getPath(root, path); - } + var newPath = parts.join('.'); - if (!keyName || keyName.length === 0) { - throw new emberDebug.Error('Property set failed: You passed an empty path'); - } + var newRoot = _getPath(root, newPath); - if (!root) { - if (tolerant) { - return; - } else { - throw new emberDebug.Error('Property set failed: object in path "' + path + '" could not be found or was destroyed.'); - } + if (newRoot) { + return set(newRoot, keyName, value); + } else if (!tolerant) { + throw new emberDebug.Error('Property set failed: object in path "' + newPath + '" could not be found or was destroyed.'); } - - return set(root, keyName, value); } /** Error-tolerant form of `Ember.set`. Will not blow up if any part of the chain is `undefined`, `null`, or destroyed. @@ -10490,11 +10401,11 @@ Ember.expandProperties('{foo}.bar.{baz}') //=> 'foo.bar.baz' ``` @method expandProperties @for Ember - @private + @public @param {String} pattern The property pattern to expand. @param {Function} callback The callback to invoke. It is invoked once per expansion, and is passed the expansion. */ function expandProperties(pattern, callback) { @@ -10533,11 +10444,10 @@ } /** @module ember-metal */ - /** Starts watching a property on an object. Whenever the property changes, invokes `Ember.propertyWillChange` and `Ember.propertyDidChange`. This is the primitive used by observers and dependent keys; usually you will never call this method directly but instead use higher level methods like @@ -10548,38 +10458,31 @@ @for Ember @param obj @param {String} _keyPath */ function watch(obj, _keyPath, m) { - if (!isPath(_keyPath)) { - watchKey(obj, _keyPath, m); - } else { + if (isPath(_keyPath)) { watchPath(obj, _keyPath, m); + } else { + watchKey(obj, _keyPath, m); } } + function watcherCount(obj, key) { + var meta$$1 = exports.peekMeta(obj); + return meta$$1 && meta$$1.peekWatching(key) || 0; + } + function unwatch(obj, _keyPath, m) { - if (!isPath(_keyPath)) { - unwatchKey(obj, _keyPath, m); - } else { + if (isPath(_keyPath)) { unwatchPath(obj, _keyPath, m); + } else { + unwatchKey(obj, _keyPath, m); } } /** - Tears down the meta on an object so that it can be garbage collected. - Multiple calls will have no effect. - - @method destroy - @for Ember - @param {Object} obj the object to destroy - @return {void} - @private - */ - - - /** @module ember @submodule ember-metal */ // .......................................................... @@ -10587,20 +10490,21 @@ // function addDependentKeys(desc, obj, keyName, meta) { // the descriptor has a list of dependent keys, so // add all of its dependent keys. - var idx = void 0, - depKey = void 0; - var depKeys = desc._dependentKeys; - if (!depKeys) { + var depKeys = desc._dependentKeys, + idx, + depKey; + if (depKeys === null || depKeys === undefined) { return; } for (idx = 0; idx < depKeys.length; idx++) { depKey = depKeys[idx]; // Increment the number of times depKey depends on keyName. + meta.writeDeps(depKey, keyName, (meta.peekDeps(depKey, keyName) || 0) + 1); // Watch the depKey watch(obj, depKey, meta); } } @@ -10609,11 +10513,11 @@ // the descriptor has a list of dependent keys, so // remove all of its dependent keys. var depKeys = desc._dependentKeys, idx, depKey; - if (!depKeys) { + if (depKeys === null || depKeys === undefined) { return; } for (idx = 0; idx < depKeys.length; idx++) { depKey = depKeys[idx]; @@ -11523,25 +11427,27 @@ return stack; }; var onerror = void 0; - var onErrorTarget = { - get onerror() { - return dispatchOverride || onerror; - } - }; - // Ember.onerror getter // Ember.onerror setter + function setOnerror(handler) { + onerror = handler; + } - var dispatchOverride = void 0; // dispatch error + function dispatchError(error) { + if (dispatchOverride) { + dispatchOverride(error); + } else { + defaultDispatch(error); + } + } - // allows testing adapter to override dispatch function defaultDispatch(error) { if (emberDebug.isTesting()) { @@ -11572,121 +11478,130 @@ * weak map will live longer (in the sense of garbage collection) than all of its * keys, otherwise it is possible to leak the values stored in the weak map. In * practice, most use cases satisfy this limitation which is why it is included * in ember-metal. */ - function WeakMap$1(iterable) { - var i, _iterable$i, key, value; + var WeakMapPolyfill = function () { + function WeakMapPolyfill(iterable) { + var i, _iterable$i, key, value; - if (!(this instanceof WeakMap$1)) { - throw new TypeError('Constructor WeakMap requires \'new\''); - } + this._id = emberUtils.GUID_KEY + id++; - this._id = emberUtils.GUID_KEY + id++; + if (iterable === null || iterable === undefined) {} else if (Array.isArray(iterable)) { + for (i = 0; i < iterable.length; i++) { + _iterable$i = iterable[i], key = _iterable$i[0], value = _iterable$i[1]; - if (iterable === null || iterable === undefined) {} else if (Array.isArray(iterable)) { - for (i = 0; i < iterable.length; i++) { - _iterable$i = iterable[i], key = _iterable$i[0], value = _iterable$i[1]; - - this.set(key, value); + this.set(key, value); + } + } else { + throw new TypeError('The weak map constructor polyfill only supports an array argument'); } - } else { - throw new TypeError('The weak map constructor polyfill only supports an array argument'); } - } - /* - * @method get - * @param key {Object | Function} - * @return {Any} stored value - */ - WeakMap$1.prototype.get = function (obj) { - if (!isObject$1(obj)) { - return undefined; - } + /* + * @method get + * @param key {Object | Function} + * @return {Any} stored value + */ - var meta$$1 = exports.peekMeta(obj), - map; - if (meta$$1) { - map = meta$$1.readableWeak(); + WeakMapPolyfill.prototype.get = function (obj) { + if (!isObject$1(obj)) { + return undefined; + } - if (map) { - if (map[this._id] === UNDEFINED) { - return undefined; + var meta$$1 = exports.peekMeta(obj), + map, + val; + if (meta$$1) { + map = meta$$1.readableWeak(); + + if (map !== undefined) { + val = map[this._id]; + + if (val === UNDEFINED) { + return undefined; + } + return val; } + } + }; - return map[this._id]; + /* + * @method set + * @param key {Object | Function} + * @param value {Any} + * @return {WeakMap} the weak map + */ + + WeakMapPolyfill.prototype.set = function (obj, value) { + if (!isObject$1(obj)) { + throw new TypeError('Invalid value used as weak map key'); } - } - }; - /* - * @method set - * @param key {Object | Function} - * @param value {Any} - * @return {WeakMap} the weak map - */ - WeakMap$1.prototype.set = function (obj, value) { - if (!isObject$1(obj)) { - throw new TypeError('Invalid value used as weak map key'); - } + if (value === undefined) { + value = UNDEFINED; + } - if (value === undefined) { - value = UNDEFINED; - } + meta(obj).writableWeak()[this._id] = value; - meta(obj).writableWeak()[this._id] = value; + return this; + }; - return this; - }; + /* + * @method has + * @param key {Object | Function} + * @return {boolean} if the key exists + */ - /* - * @method has - * @param key {Object | Function} - * @return {boolean} if the key exists - */ - WeakMap$1.prototype.has = function (obj) { - if (!isObject$1(obj)) { + WeakMapPolyfill.prototype.has = function (obj) { + if (!isObject$1(obj)) { + return false; + } + + var meta$$1 = exports.peekMeta(obj), + map; + if (meta$$1) { + map = meta$$1.readableWeak(); + + if (map !== undefined) { + return map[this._id] !== undefined; + } + } + return false; - } + }; - var meta$$1 = exports.peekMeta(obj), - map; - if (meta$$1) { - map = meta$$1.readableWeak(); + /* + * @method delete + * @param key {Object | Function} + * @return {boolean} if the key was deleted + */ - if (map) { - return map[this._id] !== undefined; + WeakMapPolyfill.prototype.delete = function (obj) { + if (this.has(obj)) { + delete exports.peekMeta(obj).writableWeak()[this._id]; + return true; + } else { + return false; } - } + }; - return false; - }; + /* + * @method toString + * @return {String} + */ - /* - * @method delete - * @param key {Object | Function} - * @return {boolean} if the key was deleted - */ - WeakMap$1.prototype.delete = function (obj) { - if (this.has(obj)) { - delete meta(obj).writableWeak()[this._id]; - return true; - } else { - return false; - } - }; + WeakMapPolyfill.prototype.toString = function () { + return '[object WeakMap]'; + }; - /* - * @method toString - * @return {String} - */ - WeakMap$1.prototype.toString = function () { - return '[object WeakMap]'; - }; + return WeakMapPolyfill; + }(); + var weak_map = emberUtils.HAS_NATIVE_WEAKMAP ? WeakMap : WeakMapPolyfill; + /** Returns true if the passed value is null or undefined. This avoids errors from JSLint complaining about use of ==, which can be technically confusing. @@ -11830,22 +11745,31 @@ @since 1.8.0 @public */ - var backburner = new Backburner(['sync', 'actions', 'destroy'], { + var onErrorTarget = { + get onerror() { + return dispatchError; + }, + set onerror(handler) { + return setOnerror(handler); + } + }; + + var backburner$1 = new Backburner(['sync', 'actions', 'destroy'], { GUID_KEY: emberUtils.GUID_KEY, sync: { before: beginPropertyChanges, after: endPropertyChanges }, defaultQueue: 'actions', onBegin: function (current) { - run$1.currentRunLoop = current; + run.currentRunLoop = current; }, onEnd: function (current, next) { - run$1.currentRunLoop = next; + run.currentRunLoop = next; }, onErrorTarget: onErrorTarget, onErrorMethod: 'onerror' }); @@ -11879,12 +11803,12 @@ then it will be looked up on the passed target. @param {Object} [args*] Any additional arguments you wish to pass to the method. @return {Object} return value from invoking the passed function. @public */ - function run$1() { - return backburner.run.apply(backburner, arguments); + function run() { + return backburner$1.run.apply(backburner$1, arguments); } /** If no run-loop is present, it creates a new one. If a run loop is present it will queue itself to run on the existing run-loops action @@ -11921,12 +11845,12 @@ @param {Object} [args*] Any additional arguments you wish to pass to the method. @return {Object} Return value from invoking the passed function. Please note, when called within an existing loop, no return value is possible. @public */ - run$1.join = function () { - return backburner.join.apply(backburner, arguments); + run.join = function () { + return backburner$1.join.apply(backburner$1, arguments); }; /** Allows you to specify which context to call the specified function in while adding the execution of that function to the Ember run loop. This ability @@ -11975,11 +11899,11 @@ @param {Object} [args*] Any additional arguments you wish to pass to the method. @return {Function} returns a new function that will always have a particular context @since 1.4.0 @public */ - run$1.bind = function () { + run.bind = function () { var _len, curried, _key; for (_len = arguments.length, curried = Array(_len), _key = 0; _key < _len; _key++) { curried[_key] = arguments[_key]; } @@ -11989,17 +11913,17 @@ for (_len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } - return run$1.join.apply(run$1, curried.concat(args)); + return run.join.apply(run, curried.concat(args)); }; }; - run$1.backburner = backburner; - run$1.currentRunLoop = null; - run$1.queues = backburner.queueNames; + run.backburner = backburner$1; + run.currentRunLoop = null; + run.queues = backburner$1.queueNames; /** Begins a new RunLoop. Any deferred actions invoked after the begin will be buffered until you invoke a matching call to `run.end()`. This is a lower-level way to use a RunLoop instead of using `run()`. @@ -12012,12 +11936,12 @@ @method begin @return {void} @public */ - run$1.begin = function () { - backburner.begin(); + run.begin = function () { + backburner$1.begin(); }; /** Ends a RunLoop. This must be called sometime after you call `run.begin()` to flush any deferred actions. This is a lower-level way @@ -12031,12 +11955,12 @@ @method end @return {void} @public */ - run$1.end = function () { - backburner.end(); + run.end = function () { + backburner$1.end(); }; /** Array of named queues. This array determines the order in which queues are flushed at the end of the RunLoop. You can define your own queues by @@ -12085,24 +12009,24 @@ invoked allowing you to change the target function. @param {Object} [arguments*] Optional arguments to be passed to the queued method. @return {*} Timer information for use in canceling, see `run.cancel`. @public */ - run$1.schedule = function () /* queue, target, method */{ - true && !(run$1.currentRunLoop || !emberDebug.isTesting()) && emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run$1.currentRunLoop || !emberDebug.isTesting()); + run.schedule = function () /* queue, target, method */{ + true && !(run.currentRunLoop || !emberDebug.isTesting()) && emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run.currentRunLoop || !emberDebug.isTesting()); - return backburner.schedule.apply(backburner, arguments); + return backburner$1.schedule.apply(backburner$1, arguments); }; // Used by global test teardown - run$1.hasScheduledTimers = function () { - return backburner.hasTimers(); + run.hasScheduledTimers = function () { + return backburner$1.hasTimers(); }; // Used by global test teardown - run$1.cancelTimers = function () { - backburner.cancelTimers(); + run.cancelTimers = function () { + backburner$1.cancelTimers(); }; /** Immediately flushes any events scheduled in the 'sync' queue. Bindings use this queue so this method is a useful way to immediately force all @@ -12118,13 +12042,13 @@ @method sync @return {void} @private */ - run$1.sync = function () { - if (backburner.currentInstance) { - backburner.currentInstance.queues.sync.flush(); + run.sync = function () { + if (backburner$1.currentInstance) { + backburner$1.currentInstance.queues.sync.flush(); } }; /** Invokes the passed target/method and optional arguments after a specified @@ -12150,12 +12074,12 @@ @param {Object} [args*] Optional arguments to pass to the timeout. @param {Number} wait Number of milliseconds to wait. @return {*} Timer information for use in canceling, see `run.cancel`. @public */ - run$1.later = function () /*target, method*/{ - return backburner.later.apply(backburner, arguments); + run.later = function () /*target, method*/{ + return backburner$1.later.apply(backburner$1, arguments); }; /** Schedule a function to run one time during the current RunLoop. This is equivalent to calling `scheduleOnce` with the "actions" queue. @@ -12167,21 +12091,21 @@ target at the time the method is invoked. @param {Object} [args*] Optional arguments to pass to the timeout. @return {Object} Timer information for use in canceling, see `run.cancel`. @public */ - run$1.once = function () { + run.once = function () { var _len3, args, _key3; - true && !(run$1.currentRunLoop || !emberDebug.isTesting()) && emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run$1.currentRunLoop || !emberDebug.isTesting()); + true && !(run.currentRunLoop || !emberDebug.isTesting()) && emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run.currentRunLoop || !emberDebug.isTesting()); for (_len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } args.unshift('actions'); - return backburner.scheduleOnce.apply(backburner, args); + return backburner$1.scheduleOnce.apply(backburner$1, args); }; /** Schedules a function to run one time in a given queue of the current RunLoop. Calling this method with the same queue/target/method combination will have @@ -12232,14 +12156,14 @@ target at the time the method is invoked. @param {Object} [args*] Optional arguments to pass to the timeout. @return {Object} Timer information for use in canceling, see `run.cancel`. @public */ - run$1.scheduleOnce = function () /*queue, target, method*/{ - true && !(run$1.currentRunLoop || !emberDebug.isTesting()) && emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run$1.currentRunLoop || !emberDebug.isTesting()); + run.scheduleOnce = function () /*queue, target, method*/{ + true && !(run.currentRunLoop || !emberDebug.isTesting()) && emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run.currentRunLoop || !emberDebug.isTesting()); - return backburner.scheduleOnce.apply(backburner, arguments); + return backburner$1.scheduleOnce.apply(backburner$1, arguments); }; /** Schedules an item to run from within a separate run loop, after control has been returned to the system. This is equivalent to calling @@ -12301,19 +12225,19 @@ target at the time the method is invoked. @param {Object} [args*] Optional arguments to pass to the timeout. @return {Object} Timer information for use in canceling, see `run.cancel`. @public */ - run$1.next = function () { + run.next = function () { var _len4, args, _key4; for (_len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } args.push(1); - return backburner.later.apply(backburner, args); + return backburner$1.later.apply(backburner$1, args); }; /** Cancels a scheduled item. Must be a value returned by `run.later()`, `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or @@ -12367,12 +12291,12 @@ @method cancel @param {Object} timer Timer object to cancel @return {Boolean} true if canceled or false/undefined if it wasn't found @public */ - run$1.cancel = function (timer) { - return backburner.cancel(timer); + run.cancel = function (timer) { + return backburner$1.cancel(timer); }; /** Delay calling the target method until the debounce period has elapsed with no additional debounce calls. If `debounce` is called again before @@ -12440,12 +12364,12 @@ @param {Boolean} immediate Trigger the function on the leading instead of the trailing edge of the wait interval. Defaults to false. @return {Array} Timer information for use in canceling, see `run.cancel`. @public */ - run$1.debounce = function () { - return backburner.debounce.apply(backburner, arguments); + run.debounce = function () { + return backburner$1.debounce.apply(backburner$1, arguments); }; /** Ensure that the target method is never called more frequently than the specified spacing period. The target method is called immediately. @@ -12483,12 +12407,12 @@ @param {Boolean} immediate Trigger the function on the leading instead of the trailing edge of the wait interval. Defaults to true. @return {Array} Timer information for use in canceling, see `run.cancel`. @public */ - run$1.throttle = function () { - return backburner.throttle.apply(backburner, arguments); + run.throttle = function () { + return backburner$1.throttle.apply(backburner$1, arguments); }; /** Add a new named queue after the specified queue. @@ -12497,13 +12421,13 @@ @method _addQueue @param {String} name the name of the queue to add. @param {String} after the name of the queue to add after. @private */ - run$1._addQueue = function (name, after) { - if (run$1.queues.indexOf(name) === -1) { - run$1.queues.splice(run$1.queues.indexOf(after) + 1, 0, name); + run._addQueue = function (name, after) { + if (run.queues.indexOf(name) === -1) { + run.queues.splice(run.queues.indexOf(after) + 1, 0, name); } }; /** Helper class that allows you to register your library with Ember. @@ -13416,11 +13340,11 @@ Binding.prototype._scheduleSync = function (dir) { var existingDir = this._direction; // If we haven't scheduled the binding yet, schedule it. if (existingDir === undefined) { - run$1.schedule('sync', this, '_sync'); + run.schedule('sync', this, '_sync'); this._direction = dir; } // If both a 'back' and 'fwd' sync have been scheduled on the same object, // default to a 'fwd' sync so that it remains deterministic. @@ -14720,20 +14644,12 @@ cache = {}; }; exports.getOnerror = function () { return onerror; }; - exports.setOnerror = function (handler) { - onerror = handler; - }; - exports.dispatchError = function (error) { - if (dispatchOverride) { - dispatchOverride(error); - } else { - defaultDispatch(error); - } - }; + exports.setOnerror = setOnerror; + exports.dispatchError = dispatchError; exports.setDispatchOverride = function (handler) { dispatchOverride = handler; }; exports.getDispatchOverride = function () { return dispatchOverride; @@ -14751,12 +14667,12 @@ } return value; }; exports.set = set; exports.trySet = trySet; - exports.WeakMap = WeakMap$1; - exports.accumulateListeners = accumulateListeners; + exports.WeakMap = weak_map; + exports.WeakMapPolyfill = WeakMapPolyfill; exports.addListener = addListener; exports.hasListeners = function (obj, eventName) { var meta$$1 = exports.peekMeta(obj); if (!meta$$1) { return false; @@ -14790,11 +14706,11 @@ exports.isEmpty = isEmpty; exports.isBlank = isBlank; exports.isPresent = function (obj) { return !isBlank(obj); }; - exports.run = run$1; + exports.run = run; exports.ObserverSet = ObserverSet; exports.beginPropertyChanges = beginPropertyChanges; exports.changeProperties = changeProperties; exports.endPropertyChanges = endPropertyChanges; exports.overrideChains = overrideChains; @@ -14823,25 +14739,25 @@ }; exports.removeChainWatcher = removeChainWatcher; exports.watchPath = watchPath; exports.unwatchPath = unwatchPath; exports.destroy = function (obj) { - deleteMeta(obj); + { + counters.deleteCalls++; + } + + var meta = exports.peekMeta(obj); + if (meta !== undefined) { + meta.destroy(); + } }; exports.isWatching = function (obj, key) { - if (typeof obj !== 'object' || obj === null) { - return false; - } - var meta$$1 = exports.peekMeta(obj); - return (meta$$1 && meta$$1.peekWatching(key)) > 0; + return watcherCount(obj, key) > 0; }; exports.unwatch = unwatch; exports.watch = watch; - exports.watcherCount = function (obj, key) { - var meta$$1 = exports.peekMeta(obj); - return meta$$1 && meta$$1.peekWatching(key) || 0; - }; + exports.watcherCount = watcherCount; exports.libraries = libraries; exports.Libraries = Libraries; exports.Map = Map; exports.MapWithDefault = MapWithDefault; exports.OrderedSet = OrderedSet; @@ -17144,10 +17060,10 @@ exports.EMBER_GLIMMER_DETECT_BACKTRACKING_RERENDER = FEATURES["ember-glimmer-detect-backtracking-rerender"]; }); enifed("ember/version", ["exports"], function (exports) { "use strict"; - exports.default = "2.15.3"; + exports.default = "2.16.0-beta.1"; }); enifed("handlebars", ["exports"], function (exports) { "use strict"; // File ignored in coverage tests via setting in .istanbul.yml