dist/ember.js in ember-source-2.1.0.beta.3 vs dist/ember.js in ember-source-2.1.0
- old
+ new
@@ -3,11 +3,11 @@
* @copyright Copyright 2011-2015 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.1.0-beta.3
+ * @version 2.1.0
*/
(function() {
var enifed, requireModule, eriuqer, requirejs, Ember;
var mainContext = this;
@@ -127,17 +127,27 @@
this.options.defaultQueue = queueNames[0];
}
this.instanceStack = [];
this._debouncees = [];
this._throttlers = [];
- this._timers = [];
this._eventCallbacks = {
end: [],
begin: []
};
+
+ this._timerTimeoutId = undefined;
+ this._timers = [];
+
+ var _this = this;
+ this._boundRunExpiredTimers = function () {
+ _this._runExpiredTimers();
+ };
}
+ // ms of delay before we conclude a timeout was lost
+ var TIMEOUT_STALLED_THRESHOLD = 1000;
+
Backburner.prototype = {
begin: function () {
var options = this.options;
var onBegin = options && options.onBegin;
var previousInstance = this.currentInstance;
@@ -289,43 +299,64 @@
}
}
}
},
+ /*
+ Join the passed method with an existing queue and execute immediately,
+ if there isn't one use `Backburner#run`.
+ The join method is like the run method except that it will schedule into
+ an existing queue if one already exists. In either case, the join method will
+ immediately execute the passed in function and return its result.
+ @method join
+ @param {Object} target
+ @param {Function} method The method to be executed
+ @param {any} args The method arguments
+ @return method result
+ */
join: function () /* target, method, args */{
- if (this.currentInstance) {
- var length = arguments.length;
- var method, target;
+ if (!this.currentInstance) {
+ return this.run.apply(this, arguments);
+ }
- if (length === 1) {
- method = arguments[0];
- target = null;
- } else {
- target = arguments[0];
- method = arguments[1];
- }
+ var length = arguments.length;
+ var method, target;
- if (_backburnerUtils.isString(method)) {
- method = target[method];
- }
+ if (length === 1) {
+ method = arguments[0];
+ target = null;
+ } else {
+ target = arguments[0];
+ method = arguments[1];
+ }
- if (length === 1) {
- return method();
- } else if (length === 2) {
- return method.call(target);
- } else {
- var args = new Array(length - 2);
- for (var i = 0, l = length - 2; i < l; i++) {
- args[i] = arguments[i + 2];
- }
- return method.apply(target, args);
- }
+ if (_backburnerUtils.isString(method)) {
+ method = target[method];
+ }
+
+ if (length === 1) {
+ return method();
+ } else if (length === 2) {
+ return method.call(target);
} else {
- return this.run.apply(this, arguments);
+ var args = new Array(length - 2);
+ for (var i = 0, l = length - 2; i < l; i++) {
+ args[i] = arguments[i + 2];
+ }
+ return method.apply(target, args);
}
},
+ /*
+ Defer the passed function to run inside the specified queue.
+ @method defer
+ @param {String} queueName
+ @param {Object} target
+ @param {Function|String} method The method or method name to be executed
+ @param {any} args The method arguments
+ @return method result
+ */
defer: function (queueName /* , target, method, args */) {
var length = arguments.length;
var method, target, args;
if (length === 2) {
@@ -464,16 +495,31 @@
} else {
method.apply(target, args);
}
}
+ return this._setTimeout(fn, executeAt);
+ },
+
+ _setTimeout: function (fn, executeAt) {
+ if (this._timers.length === 0) {
+ this._timers.push(executeAt, fn);
+ this._installTimerTimeout();
+ return fn;
+ }
+
+ this._reinstallStalledTimerTimeout();
+
// find position to insert
var i = _backburnerBinarySearch.default(executeAt, this._timers);
this._timers.splice(i, 0, executeAt, fn);
- updateLaterTimer(this, executeAt, wait);
+ // we should be the new earliest timer if i == 0
+ if (i === 0) {
+ this._reinstallTimerTimeout();
+ }
return fn;
},
throttle: function (target, method /* , args, wait, [immediate] */) {
@@ -567,24 +613,17 @@
return debouncee;
},
cancelTimers: function () {
- var clearItems = function (item) {
- clearTimeout(item[2]);
- };
-
_backburnerUtils.each(this._throttlers, clearItems);
this._throttlers = [];
_backburnerUtils.each(this._debouncees, clearItems);
this._debouncees = [];
- if (this._laterTimer) {
- clearTimeout(this._laterTimer);
- this._laterTimer = null;
- }
+ this._clearTimerTimeout();
this._timers = [];
if (this._autorun) {
clearTimeout(this._autorun);
this._autorun = null;
@@ -605,19 +644,11 @@
// we're cancelling a setTimeout
for (var i = 0, l = this._timers.length; i < l; i += 2) {
if (this._timers[i + 1] === timer) {
this._timers.splice(i, 2); // remove the two elements
if (i === 0) {
- if (this._laterTimer) {
- // Active timer? Then clear timer and reset for future timer
- clearTimeout(this._laterTimer);
- this._laterTimer = null;
- }
- if (this._timers.length > 0) {
- // Update to next available timer when available
- updateLaterTimer(this, this._timers[0], this._timers[0] - _backburnerUtils.now());
- }
+ this._reinstallTimerTimeout();
}
return true;
}
}
} else if (Object.prototype.toString.call(timer) === '[object Array]') {
@@ -647,10 +678,71 @@
return true;
}
}
return false;
+ },
+
+ _runExpiredTimers: function () {
+ this._timerTimeoutId = undefined;
+ this.run(this, this._scheduleExpiredTimers);
+ },
+
+ _scheduleExpiredTimers: function () {
+ var n = _backburnerUtils.now();
+ var timers = this._timers;
+ var i = 0;
+ var l = timers.length;
+ for (; i < l; i += 2) {
+ var executeAt = timers[i];
+ var fn = timers[i + 1];
+ if (executeAt <= n) {
+ this.schedule(this.options.defaultQueue, null, fn);
+ } else {
+ break;
+ }
+ }
+ timers.splice(0, i);
+ this._installTimerTimeout();
+ },
+
+ _reinstallStalledTimerTimeout: function () {
+ if (!this._timerTimeoutId) {
+ return;
+ }
+ // if we have a timer we should always have a this._timerTimeoutId
+ var minExpiresAt = this._timers[0];
+ var delay = _backburnerUtils.now() - minExpiresAt;
+ // threshold of a second before we assume that the currently
+ // installed timeout will not run, so we don't constantly reinstall
+ // timeouts that are delayed but good still
+ if (delay < TIMEOUT_STALLED_THRESHOLD) {
+ return;
+ }
+ },
+
+ _reinstallTimerTimeout: function () {
+ this._clearTimerTimeout();
+ this._installTimerTimeout();
+ },
+
+ _clearTimerTimeout: function () {
+ if (!this._timerTimeoutId) {
+ return;
+ }
+ clearTimeout(this._timerTimeoutId);
+ this._timerTimeoutId = undefined;
+ },
+
+ _installTimerTimeout: function () {
+ if (!this._timers.length) {
+ return;
+ }
+ var minExpiresAt = this._timers[0];
+ var n = _backburnerUtils.now();
+ var wait = Math.max(0, minExpiresAt - n);
+ this._timerTimeoutId = setTimeout(this._boundRunExpiredTimers, wait);
}
};
Backburner.prototype.schedule = Backburner.prototype.defer;
Backburner.prototype.scheduleOnce = Backburner.prototype.deferOnce;
@@ -674,56 +766,10 @@
backburner._autorun = null;
backburner.end();
});
}
- function updateLaterTimer(backburner, executeAt, wait) {
- var n = _backburnerUtils.now();
- if (!backburner._laterTimer || executeAt < backburner._laterTimerExpiresAt || backburner._laterTimerExpiresAt < n) {
-
- if (backburner._laterTimer) {
- // Clear when:
- // - Already expired
- // - New timer is earlier
- clearTimeout(backburner._laterTimer);
-
- if (backburner._laterTimerExpiresAt < n) {
- // If timer was never triggered
- // Calculate the left-over wait-time
- wait = Math.max(0, executeAt - n);
- }
- }
-
- backburner._laterTimer = _backburnerPlatform.default.setTimeout(function () {
- backburner._laterTimer = null;
- backburner._laterTimerExpiresAt = null;
- executeTimers(backburner);
- }, wait);
-
- backburner._laterTimerExpiresAt = n + wait;
- }
- }
-
- function executeTimers(backburner) {
- var n = _backburnerUtils.now();
- var fns, i, l;
-
- backburner.run(function () {
- i = _backburnerBinarySearch.default(n, backburner._timers);
-
- fns = backburner._timers.splice(0, i);
-
- for (i = 1, l = fns.length; i < l; i += 2) {
- backburner.schedule(backburner.options.defaultQueue, null, fns[i]);
- }
- });
-
- if (backburner._timers.length) {
- updateLaterTimer(backburner, backburner._timers[0], backburner._timers[0] - n);
- }
- }
-
function findDebouncee(target, method, debouncees) {
return findItem(target, method, debouncees);
}
function findThrottler(target, method, throttlers) {
@@ -742,10 +788,14 @@
}
}
return index;
}
+
+ function clearItems(item) {
+ clearTimeout(item[2]);
+ }
});
enifed("backburner/binary-search", ["exports"], function (exports) {
"use strict";
exports.default = binarySearch;
@@ -819,14 +869,13 @@
},
flush: function () {
var queues = this.queues;
var queueNames = this.queueNames;
- var queueName, queue, queueItems, priorQueueNameIndex;
+ var queueName, queue;
var queueNameIndex = 0;
var numberOfQueues = queueNames.length;
- var options = this.options;
while (queueNameIndex < numberOfQueues) {
queueName = queueNames[queueNameIndex];
queue = queues[queueName];
@@ -946,15 +995,10 @@
method: method
};
},
pushUnique: function (target, method, args, stack) {
- var queue = this._queue,
- currentTarget,
- currentMethod,
- i,
- l;
var KEY = this.globalOptions.GUID_KEY;
if (target && KEY) {
var guid = target[KEY];
if (guid) {
@@ -3403,11 +3447,10 @@
*/
enifed('ember-application/system/application-instance', ['exports', 'ember-metal', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-runtime/system/object', 'ember-metal/run_loop', 'ember-metal/computed', 'container/registry', 'ember-runtime/mixins/registry_proxy', 'ember-runtime/mixins/container_proxy', 'ember-metal/assign'], function (exports, _emberMetal, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _emberRuntimeSystemObject, _emberMetalRun_loop, _emberMetalComputed, _containerRegistry, _emberRuntimeMixinsRegistry_proxy, _emberRuntimeMixinsContainer_proxy, _emberMetalAssign) {
/**
@module ember
@submodule ember-application
- @private
*/
'use strict';
/**
@@ -3429,10 +3472,14 @@
That state is what the `ApplicationInstance` manages: it is responsible for
creating the container that contains all application state, and disposing of
it once the particular test run or FastBoot request has finished.
@public
+ @class Ember.ApplicationInstance
+ @extends Ember.Object
+ @uses RegistryProxyMixin
+ @uses ContainerProxyMixin
*/
var ApplicationInstance = _emberRuntimeSystemObject.default.extend(_emberRuntimeMixinsRegistry_proxy.default, _emberRuntimeMixinsContainer_proxy.default, {
/**
The `Application` for which this is an instance.
@@ -3600,11 +3647,16 @@
enumerable: false,
get: function () {
var instance = this;
return {
lookup: function () {
- _emberMetal.default.deprecate('Using `ApplicationInstance.container.lookup` is deprecated. Please use `ApplicationInstance.lookup` instead.', false, { id: 'ember-application.app-instance-container', until: '3.0.0' });
+ _emberMetal.default.deprecate('Using `ApplicationInstance.container.lookup` is deprecated. Please use `ApplicationInstance.lookup` instead.', false, {
+ id: 'ember-application.app-instance-container',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-applicationinstance-container'
+ });
+
return instance.lookup.apply(instance, arguments);
}
};
}
});
@@ -3756,11 +3808,11 @@
application.register('api-adapter:main', ApiAdapter);
}
});
```
- Initializers provide an opportunity to access the container, which
+ Initializers provide an opportunity to access the internal registry, which
organizes the different components of an Ember application. Additionally
they provide a chance to access the instantiated application. Beyond
being used for libraries, initializers are also a great way to organize
dependency injection or setup in your own application.
@@ -3789,10 +3841,11 @@
begins.
@class Application
@namespace Ember
@extends Ember.Namespace
+ @uses RegistryProxyMixin
@public
*/
var Application = _emberRuntimeSystemNamespace.default.extend(_emberRuntimeMixinsRegistry_proxy.default, {
_suppressDeferredDeprecation: true,
@@ -4131,11 +4184,15 @@
runInitializers: function () {
var App = this;
this._runInitializer('initializers', function (name, initializer) {
_emberMetal.default.assert('No application initializer named \'' + name + '\'', !!initializer);
if (initializer.initialize.length === 2) {
- _emberMetal.default.deprecate('The `initialize` method for Application initializer \'' + name + '\' should take only one argument - `App`, an instance of an `Application`.', false, { id: 'ember-application.app-initializer-initialize-arguments', until: '3.0.0' });
+ _emberMetal.default.deprecate('The `initialize` method for Application initializer \'' + name + '\' should take only one argument - `App`, an instance of an `Application`.', false, {
+ id: 'ember-application.app-initializer-initialize-arguments',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_initializer-arity'
+ });
initializer.initialize(App.__registry__, App);
} else {
initializer.initialize(App);
}
@@ -5320,14 +5377,70 @@
_emberMetalCore.default.debug('For more advanced debugging, install the Ember Inspector from ' + downloadURL);
}
}, false);
}
}
-
+ /**
+ @public
+ @class Ember.Debug
+ */
_emberMetalCore.default.Debug = {};
+ /**
+ Allows for runtime registration of handler functions that override the default deprecation behavior.
+ Deprecations are invoked by calls to [Ember.deprecate](http://emberjs.com/api/classes/Ember.html#method_deprecate).
+ The following example demonstrates its usage by registering a handler that throws an error if the
+ message contains the word "should", otherwise defers to the default handler.
+ ```javascript
+ Ember.Debug.registerDeprecationHandler((message, options, next) => {
+ if (message.indexOf('should') !== -1) {
+ throw new Error(`Deprecation message with should: ${message}`);
+ } else {
+ // defer to whatever handler was registered before this one
+ next(message, options);
+ }
+ }
+ ```
+ The handler function takes the following arguments:
+ <ul>
+ <li> <code>message</code> - The message received from the deprecation call. </li>
+ <li> <code>options</code> - An object passed in with the deprecation call containing additional information including:</li>
+ <ul>
+ <li> <code>id</code> - an id of the deprecation in the form of <code>package-name.specific-deprecation</code>.</li>
+ <li> <code>until</code> - is the version number Ember the feature and deprecation will be removed in.</li>
+ </ul>
+ <li> <code>next</code> - a function that calls into the previously registered handler.</li>
+ </ul>
+ @public
+ @static
+ @method registerDeprecationHandler
+ @param handler {Function} a function to handle deprecation calls
+ */
_emberMetalCore.default.Debug.registerDeprecationHandler = _emberDebugDeprecate.registerHandler;
+ /**
+ Allows for runtime registration of handler functions that override the default warning behavior.
+ Warnings are invoked by calls made to [Ember.warn](http://emberjs.com/api/classes/Ember.html#method_warn).
+ The following example demonstrates its usage by registering a handler that does nothing overriding Ember's
+ default warning behavior.
+ ```javascript
+ // next is not called, so no warnings get the default behavior
+ Ember.Debug.registerWarnHandler(() => {});
+ ```
+ The handler function takes the following arguments:
+ <ul>
+ <li> <code>message</code> - The message received from the warn call. </li>
+ <li> <code>options</code> - An object passed in with the warn call containing additional information including:</li>
+ <ul>
+ <li> <code>id</code> - an id of the warning in the form of <code>package-name.specific-warning</code>.</li>
+ </ul>
+ <li> <code>next</code> - a function that calls into the previously registered handler.</li>
+ </ul>
+ @public
+ @static
+ @method registerWarnHandler
+ @param handler {Function} a function to handle warnings
+ */
_emberMetalCore.default.Debug.registerWarnHandler = _emberDebugWarn.registerHandler;
/*
We are transitioning away from `ember.js` to `ember.debug.js` to make
it much clearer that it is only for local development purposes.
@@ -5444,19 +5557,31 @@
@public
*/
function deprecate(message, test, options) {
if (!options || !options.id && !options.until) {
- deprecate(missingOptionsDeprecation, false, { id: 'ember-debug.deprecate-options-missing', until: '3.0.0' });
+ deprecate(missingOptionsDeprecation, false, {
+ id: 'ember-debug.deprecate-options-missing',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
+ });
}
if (options && !options.id) {
- deprecate(missingOptionsIdDeprecation, false, { id: 'ember-debug.deprecate-id-missing', until: '3.0.0' });
+ deprecate(missingOptionsIdDeprecation, false, {
+ id: 'ember-debug.deprecate-id-missing',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
+ });
}
if (options && !options.until) {
- deprecate(missingOptionsUntilDeprecation, options && options.until, { id: 'ember-debug.deprecate-until-missing', until: '3.0.0' });
+ deprecate(missingOptionsUntilDeprecation, options && options.until, {
+ id: 'ember-debug.deprecate-until-missing',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
+ });
}
_emberDebugHandlers.invoke.apply(undefined, ['deprecate'].concat(_slice.call(arguments)));
}
});
@@ -5539,15 +5664,23 @@
@public
*/
function warn(message, test, options) {
if (!options) {
- _emberMetalCore.default.deprecate(missingOptionsDeprecation, false, { id: 'ember-debug.warn-options-missing', until: '3.0.0' });
+ _emberMetalCore.default.deprecate(missingOptionsDeprecation, false, {
+ id: 'ember-debug.warn-options-missing',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
+ });
}
if (options && !options.id) {
- _emberMetalCore.default.deprecate(missingOptionsIdDeprecation, false, { id: 'ember-debug.warn-id-missing', until: '3.0.0' });
+ _emberMetalCore.default.deprecate(missingOptionsIdDeprecation, false, {
+ id: 'ember-debug.warn-id-missing',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options'
+ });
}
_emberDebugHandlers.invoke.apply(undefined, ['warn'].concat(_slice.call(arguments)));
}
});
@@ -5591,11 +5724,11 @@
```javascript
Application.initializer({
name: "containerDebugAdapter",
- initialize: function(container, application) {
+ initialize: function(application) {
application.register('container-debug-adapter:main', require('app/container-debug-adapter'));
}
});
```
@@ -5710,11 +5843,11 @@
```javascript
Application.initializer({
name: "data-adapter",
- initialize: function(container, application) {
+ initialize: function(application) {
application.register('data-adapter:main', DS.DataAdapter);
}
});
```
@@ -8367,11 +8500,11 @@
}
return false;
}
});
-enifed('ember-htmlbars/keywords/get', ['exports', 'ember-metal/core', 'ember-metal/streams/stream', 'ember-metal/streams/key-stream', 'ember-metal/streams/utils', 'ember-metal/merge', 'ember-htmlbars/utils/subscribe', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/observer'], function (exports, _emberMetalCore, _emberMetalStreamsStream, _emberMetalStreamsKeyStream, _emberMetalStreamsUtils, _emberMetalMerge, _emberHtmlbarsUtilsSubscribe, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalObserver) {
+enifed('ember-htmlbars/keywords/get', ['exports', 'ember-metal/core', 'ember-metal/streams/stream', 'ember-metal/streams/utils', 'ember-metal/merge', 'ember-htmlbars/utils/subscribe', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/observer'], function (exports, _emberMetalCore, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberMetalMerge, _emberHtmlbarsUtilsSubscribe, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalObserver) {
/**
@module ember
@submodule ember-templates
*/
@@ -8458,32 +8591,28 @@
return true;
};
var DynamicKeyStream = function DynamicKeyStream(source, keySource) {
if (!_emberMetalStreamsUtils.isStream(keySource)) {
- return new _emberMetalStreamsKeyStream.default(source, keySource);
+ return source.get(keySource);
}
- _emberMetalCore.default.assert('DynamicKeyStream error: source must be a stream', _emberMetalStreamsUtils.isStream(source)); // TODO: This isn't necessary.
-
- // used to get the original path for debugging and legacy purposes
var label = labelFor(source, keySource);
this.init(label);
this.path = label;
this.sourceDep = this.addMutableDependency(source);
this.keyDep = this.addMutableDependency(keySource);
this.observedObject = null;
this.observedKey = null;
};
- DynamicKeyStream.prototype = Object.create(_emberMetalStreamsKeyStream.default.prototype);
+ DynamicKeyStream.prototype = Object.create(_emberMetalStreamsStream.default.prototype);
_emberMetalMerge.default(DynamicKeyStream.prototype, {
key: function () {
var key = this.keyDep.getValue();
if (typeof key === 'string') {
- _emberMetalCore.default.assert('DynamicKeyStream error: key must not have a \'.\'', key.indexOf('.') === -1);
return key;
}
},
compute: function () {
@@ -8868,11 +8997,11 @@
@submodule ember-templates
*/
'use strict';
- _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.1.0-beta.3';
+ _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.1.0';
/**
The `{{outlet}}` helper lets you specify where a child routes will render in
your template. An important use of the `{{outlet}}` helper is in your
application's `application.hbs` file:
@@ -9925,32 +10054,46 @@
function processPositionalParams(renderNode, positionalParams, params, attrs) {
// if the component is rendered via {{component}} helper, the first
// element of `params` is the name of the component, so we need to
// skip that when the positional parameters are constructed
- var paramsStartIndex = renderNode.state.isComponentHelper ? 1 : 0;
var isNamed = typeof positionalParams === 'string';
- var paramsStream = undefined;
if (isNamed) {
- paramsStream = new _emberMetalStreamsStream.default(function () {
- return _emberMetalStreamsUtils.readArray(params.slice(paramsStartIndex));
- }, 'params');
+ processRestPositionalParameters(renderNode, positionalParams, params, attrs);
+ } else {
+ processNamedPositionalParameters(renderNode, positionalParams, params, attrs);
+ }
+ }
- attrs[positionalParams] = paramsStream;
+ function processNamedPositionalParameters(renderNode, positionalParams, params, attrs) {
+ var paramsStartIndex = renderNode.state.isComponentHelper ? 1 : 0;
+
+ for (var i = 0; i < positionalParams.length; i++) {
+ var param = params[paramsStartIndex + i];
+
+ _emberMetalCore.default.assert('You cannot specify both a positional param (at position ' + i + ') and the hash argument `' + positionalParams[i] + '`.', !(positionalParams[i] in attrs));
+
+ attrs[positionalParams[i]] = param;
}
+ }
- if (isNamed) {
- for (var i = paramsStartIndex; i < params.length; i++) {
- var param = params[i];
- paramsStream.addDependency(param);
- }
- } else {
- for (var i = 0; i < positionalParams.length; i++) {
- var param = params[paramsStartIndex + i];
- attrs[positionalParams[i]] = param;
- }
+ function processRestPositionalParameters(renderNode, positionalParamsName, params, attrs) {
+ // If there is already an attribute for that variable, do nothing
+ _emberMetalCore.default.assert('You cannot specify positional parameters and the hash argument `' + positionalParamsName + '`.', !(positionalParamsName in attrs));
+
+ var paramsStartIndex = renderNode.state.isComponentHelper ? 1 : 0;
+
+ var paramsStream = new _emberMetalStreamsStream.default(function () {
+ return _emberMetalStreamsUtils.readArray(params.slice(paramsStartIndex));
+ }, 'params');
+
+ attrs[positionalParamsName] = paramsStream;
+
+ for (var i = paramsStartIndex; i < params.length; i++) {
+ var param = params[i];
+ paramsStream.addDependency(param);
}
}
function configureTagName(attrs, tagName, component, isAngleBracket, createOptions) {
if (isAngleBracket) {
@@ -14172,85 +14315,109 @@
// ..........................................................
// COMPUTED PROPERTY
//
/**
- A computed property transforms an object's function into a property.
+ A computed property transforms an object literal with object's accessor function(s) into a property.
By default the function backing the computed property will only be called
once and the result will be cached. You can specify various properties
that your computed property depends on. This will force the cached
result to be recomputed if the dependencies are modified.
- In the following example we declare a computed property (by calling
- `.property()` on the fullName function) and setup the property
- dependencies (depending on firstName and lastName). The fullName function
+ In the following example we declare a computed property - `fullName` - by calling
+ `.Ember.computed()` with property dependencies (`firstName` and `lastName`) as leading arguments and getter accessor function. The `fullName` getter function
will be called once (regardless of how many times it is accessed) as long
- as its dependencies have not changed. Once firstName or lastName are updated
- any future calls (or anything bound) to fullName will incorporate the new
+ as its dependencies have not changed. Once `firstName` or `lastName` are updated
+ any future calls (or anything bound) to `fullName` will incorporate the new
values.
```javascript
- var Person = Ember.Object.extend({
+ let Person = Ember.Object.extend({
// these will be supplied by `create`
firstName: null,
lastName: null,
- fullName: function() {
- var firstName = this.get('firstName');
- var lastName = this.get('lastName');
+ fullName: Ember.computed('firstName', 'lastName', function() {
+ let firstName = this.get('firstName'),
+ lastName = this.get('lastName');
- return firstName + ' ' + lastName;
- }.property('firstName', 'lastName')
+ return firstName + ' ' + lastName;
+ })
});
- var tom = Person.create({
+ let tom = Person.create({
firstName: 'Tom',
lastName: 'Dale'
});
tom.get('fullName') // 'Tom Dale'
```
- You can also define what Ember should do when setting a computed property.
- If you try to set a computed property, it will be invoked with the key and
- value you want to set it to. You can also accept the previous value as the
- third parameter.
+ You can also define what Ember should do when setting a computed property by providing additional function (`set`) in hash argument.
+ If you try to set a computed property, it will try to invoke setter accessor function with the key and
+ value you want to set it to as arguments.
```javascript
- var Person = Ember.Object.extend({
+ let Person = Ember.Object.extend({
// these will be supplied by `create`
firstName: null,
lastName: null,
- fullName: function(key, value, oldValue) {
- // getter
- if (arguments.length === 1) {
- var firstName = this.get('firstName');
- var lastName = this.get('lastName');
+ fullName: Ember.computed('firstName', 'lastName', {
+ get(key) {
+ let firstName = this.get('firstName'),
+ lastName = this.get('lastName');
return firstName + ' ' + lastName;
+ },
+ set(key, value) {
+ let [firstName, lastName] = value.split(' ');
- // setter
- } else {
- var name = value.split(' ');
+ this.set('firstName', firstName);
+ this.set('lastName', lastName);
- this.set('firstName', name[0]);
- this.set('lastName', name[1]);
-
return value;
}
- }.property('firstName', 'lastName')
+ })
});
- var person = Person.create();
+ let person = Person.create();
person.set('fullName', 'Peter Wagenet');
person.get('firstName'); // 'Peter'
person.get('lastName'); // 'Wagenet'
```
+ You can overwrite computed property with normal property (no longer computed), that won't change if dependencies change, if you set computed property and it won't have setter accessor function defined.
+
+ You can also mark computed property as `.readOnly()` and block all attempts to set it.
+
+ ```javascript
+ let Person = Ember.Object.extend({
+ // these will be supplied by `create`
+ firstName: null,
+ lastName: null,
+
+ fullName: Ember.computed('firstName', 'lastName', {
+ get(key) {
+ let firstName = this.get('firstName');
+ let lastName = this.get('lastName');
+
+ return firstName + ' ' + lastName;
+ }
+ }).readOnly()
+ });
+
+ let person = Person.create();
+ person.set('fullName', 'Peter Wagenet'); // Uncaught Error: Cannot set read-only property "fullName" on object: <(...):emberXXX>
+ ```
+
+ Additional resources:
+ - [New CP syntax RFC](https://github.com/emberjs/rfcs/blob/master/text/0011-improved-cp-syntax.md)
+ - [New computed syntax explained in "Ember 1.12 released" ](http://emberjs.com/blog/2015/05/13/ember-1-12-released.html#toc_new-computed-syntax)
+
@class ComputedProperty
@namespace Ember
@constructor
@public
*/
@@ -14294,14 +14461,14 @@
Dependency keys have no effect on volatile properties as they are for cache
invalidation and notification when cached value is invalidated.
```javascript
- var outsideService = Ember.Object.extend({
- value: function() {
+ let outsideService = Ember.Object.extend({
+ value: Ember.computed(function() {
return OutsideService.getValue();
- }.property().volatile()
+ }).volatile()
}).create();
```
@method volatile
@return {Ember.ComputedProperty} this
@@ -14316,17 +14483,17 @@
/**
Call on a computed property to set it into read-only mode. When in this
mode the computed property will throw an error when set.
```javascript
- var Person = Ember.Object.extend({
- guid: function() {
+ let Person = Ember.Object.extend({
+ guid: Ember.computed(function() {
return 'guid-guid-guid';
- }.property().readOnly()
+ }).readOnly()
});
- var person = Person.create();
+ let person = Person.create();
person.set('guid', 'new-guid'); // will throw an exception
```
@method readOnly
@@ -14343,20 +14510,20 @@
/**
Sets the dependent keys on this computed property. Pass any number of
arguments containing key paths that this computed property depends on.
```javascript
- var President = Ember.Object.extend({
- fullName: computed(function() {
+ let President = Ember.Object.extend({
+ fullName: Ember.computed(function() {
return this.get('firstName') + ' ' + this.get('lastName');
// Tell Ember that this computed property depends on firstName
// and lastName
}).property('firstName', 'lastName')
});
- var president = President.create({
+ let president = President.create({
firstName: 'Barack',
lastName: 'Obama'
});
president.get('fullName'); // 'Barack Obama'
@@ -14392,14 +14559,14 @@
available for introspection.
You can pass a hash of these values to a computed property like this:
```
- person: function() {
- var personId = this.get('personId');
+ person: Ember.computed(function() {
+ let personId = this.get('personId');
return App.Person.create({ id: personId });
- }.property().meta({ type: App.Person })
+ }).meta({ type: App.Person })
```
The hash that you pass to the `meta()` function will be saved on the
computed property descriptor under the `_meta` key. Ember runtime
exposes a public API for retrieving these values from classes,
@@ -14445,19 +14612,19 @@
Access the value of the function backing the computed property.
If this property has already been cached, return the cached result.
Otherwise, call the function passing the property name as an argument.
```javascript
- var Person = Ember.Object.extend({
- fullName: function(keyName) {
+ let Person = Ember.Object.extend({
+ fullName: Ember.computed('firstName', 'lastName', function(keyName) {
// the keyName parameter is 'fullName' in this case.
return this.get('firstName') + ' ' + this.get('lastName');
- }.property('firstName', 'lastName')
+ })
});
- var tom = Person.create({
+ let tom = Person.create({
firstName: 'Tom',
lastName: 'Dale'
});
tom.get('fullName') // 'Tom Dale'
@@ -14504,49 +14671,48 @@
computed property does not accept arguments then the default action for
setting would be to define the property on the current object, and set
the value of the property to the value being set.
Generally speaking if you intend for your computed property to be set
- your backing function should accept either two or three arguments.
+ you should pass `set(key, value)` function in hash as argument to `Ember.computed()` along with `get(key)` function.
```javascript
- var Person = Ember.Object.extend({
+ let Person = Ember.Object.extend({
// these will be supplied by `create`
firstName: null,
lastName: null,
- fullName: function(key, value, oldValue) {
+ fullName: Ember.computed('firstName', 'lastName', {
// getter
- if (arguments.length === 1) {
- var firstName = this.get('firstName');
- var lastName = this.get('lastName');
+ get() {
+ let firstName = this.get('firstName');
+ let lastName = this.get('lastName');
return firstName + ' ' + lastName;
-
+ },
// setter
- } else {
- var name = value.split(' ');
+ set(key, value) {
+ let [firstName, lastName] = value.split(' ');
- this.set('firstName', name[0]);
- this.set('lastName', name[1]);
+ this.set('firstName', firstName);
+ this.set('lastName', lastName);
return value;
}
- }.property('firstName', 'lastName')
+ })
});
- var person = Person.create();
+ let person = Person.create();
person.set('fullName', 'Peter Wagenet');
person.get('firstName'); // 'Peter'
person.get('lastName'); // 'Wagenet'
```
@method set
@param {String} keyName The key being accessed.
@param {Object} newValue The new value being assigned.
- @param {String} oldValue The old value being replaced.
@return {Object} The return value of the function backing the CP.
@public
*/
ComputedPropertyPrototype.set = function computedPropertySetEntry(obj, keyName, value) {
if (this._readOnly) {
@@ -14652,28 +14818,30 @@
/**
This helper returns a new property descriptor that wraps the passed
computed property function. You can use this helper to define properties
with mixins or via `Ember.defineProperty()`.
- The function you pass will be used to both get and set property values.
- The function should accept two parameters, key and value. If value is not
- undefined you should set the value first. In either case return the
+ If you pass function as argument - it will be used as getter.
+ You can pass hash with two functions - instead of single function - as argument to provide both getter and setter.
+
+ The `get` function should accept two parameters, `key` and `value`. If `value` is not
+ undefined you should set the `value` first. In either case return the
current value of the property.
A computed property defined in this way might look like this:
```js
- var Person = Ember.Object.extend({
+ let Person = Ember.Object.extend({
firstName: 'Betty',
lastName: 'Jones',
- fullName: Ember.computed('firstName', 'lastName', function(key, value) {
+ fullName: Ember.computed('firstName', 'lastName', function() {
return this.get('firstName') + ' ' + this.get('lastName');
})
});
- var client = Person.create();
+ let client = Person.create();
client.get('fullName'); // 'Betty Jones'
client.set('lastName', 'Fuller');
client.get('fullName'); // 'Betty Fuller'
@@ -14687,11 +14855,11 @@
[Prototype Extensions](http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/).
The alternative syntax might look like this
(if prototype extensions are enabled, which is the default behavior):
```js
- fullName: function () {
+ fullName() {
return this.get('firstName') + ' ' + this.get('lastName');
}.property('firstName', 'lastName')
```
@class computed
@@ -14791,11 +14959,11 @@
cross-platform libraries such as jQuery. For more details, see
[Ember-Runtime](http://emberjs.com/api/modules/ember-runtime.html).
@class Ember
@static
- @version 2.1.0-beta.3
+ @version 2.1.0
@public
*/
'use strict';
@@ -14825,15 +14993,15 @@
/**
The semantic version.
@property VERSION
@type String
- @default '2.1.0-beta.3'
+ @default '2.1.0'
@static
@public
*/
- Ember.VERSION = '2.1.0-beta.3';
+ Ember.VERSION = '2.1.0';
/**
The hash of environment variables used to control various configuration
settings. To specify your own or override default settings, add the
desired properties to a global hash named `EmberENV` (or `ENV` for
@@ -21263,11 +21431,11 @@
`Ember.Object`-based or not, but be aware that it will add a `_guid`
property.
You can also use this method on DOM Element objects.
- @private
+ @public
@method guidFor
@for Ember
@param {Object} obj any object, string, number, Element, or primitive
@return {String} the unique guid for this instance.
*/
@@ -21336,18 +21504,20 @@
}
return ret;
}
}
+ var HAS_SUPER_PATTERN = /\.(_super|call\(this|apply\(this)/;
+
var checkHasSuper = (function () {
var sourceAvailable = (function () {
return this;
}).toString().indexOf('return this;') > -1;
if (sourceAvailable) {
return function checkHasSuper(func) {
- return func.toString().indexOf('_super') > -1;
+ return HAS_SUPER_PATTERN.test(func.toString());
};
}
return function checkHasSuper() {
return true;
@@ -23047,11 +23217,11 @@
@submodule ember-routing-views
*/
'use strict';
- _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.1.0-beta.3';
+ _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.1.0';
/**
`Ember.LinkComponent` renders an element whose `click` event triggers a
transition of the application's instance of `Ember.Router` to
a supplied route by name.
@@ -23468,26 +23638,14 @@
// Do not mutate params in place
var params = attrs.params.slice();
_emberMetalCore.default.assert('You must provide one or more parameters to the link-to component.', params.length);
- if (attrs.disabledClass) {
- this.set('disabledClass', attrs.disabledClass);
- }
-
- if (attrs.activeClass) {
- this.set('activeClass', attrs.activeClass);
- }
-
if (attrs.disabledWhen) {
this.set('disabled', attrs.disabledWhen);
}
- if (attrs.loadingClass) {
- this.set('loadingClass', attrs.loadingClass);
- }
-
// Process the positional arguments, in order.
// 1. Inline link title comes first, if present.
if (!this[_emberHtmlbarsNodeManagersComponentNodeManager.HAS_BLOCK]) {
this.set('linkTitle', params.shift());
}
@@ -23542,11 +23700,11 @@
@submodule ember-routing-views
*/
'use strict';
- _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.1.0-beta.3';
+ _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.1.0';
var CoreOutletView = _emberViewsViewsView.default.extend({
defaultTemplate: _emberHtmlbarsTemplatesTopLevelView.default,
init: function () {
@@ -30881,12 +31039,23 @@
*/
compare: null
});
});
enifed('ember-runtime/mixins/container_proxy', ['exports', 'ember-metal/run_loop', 'ember-metal/mixin'], function (exports, _emberMetalRun_loop, _emberMetalMixin) {
+ /**
+ @module ember
+ @submodule ember-runtime
+ */
'use strict';
+ /**
+ ContainerProxyMixin is used to provide public access to specific
+ container functionality.
+
+ @class ContainerProxyMixin
+ @private
+ */
exports.default = _emberMetalMixin.Mixin.create({
/**
The container stores state.
@private
@property {Ember.Container} __container__
@@ -31660,11 +31829,11 @@
```
@method any
@param {Function} callback The callback to execute
@param {Object} [target] The target object to use
@return {Boolean} `true` if the passed function returns `true` for any item
- @private
+ @public
*/
any: function (callback, target) {
var len = _emberMetalProperty_get.get(this, 'length');
var context = popCtx();
var found = false;
@@ -31724,11 +31893,11 @@
@method reduce
@param {Function} callback The callback to execute
@param {Object} initialValue Initial value for the reduce
@param {String} reducerProperty internal use only.
@return {Object} The reduced value.
- @private
+ @public
*/
reduce: function (callback, initialValue, reducerProperty) {
if (typeof callback !== 'function') {
throw new TypeError();
}
@@ -31748,11 +31917,11 @@
Prototype 1.6.
@method invoke
@param {String} methodName the name of the method
@param {Object...} args optional arguments to pass as well.
@return {Array} return values from calling invoke.
- @private
+ @public
*/
invoke: function (methodName) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
@@ -31773,11 +31942,11 @@
/**
Simply converts the enumerable into a genuine array. The order is not
guaranteed. Corresponds to the method implemented by Prototype.
@method toArray
@return {Array} the enumerable as an array.
- @private
+ @public
*/
toArray: function () {
var ret = _emberMetalCore.default.A();
this.forEach(function (o, idx) {
@@ -31840,11 +32009,11 @@
arr.uniq(); // ['a', 'b']
```
This only works on primitive data types, e.g. Strings, Numbers, etc.
@method uniq
@return {Ember.Enumerable}
- @private
+ @public
*/
uniq: function () {
var ret = _emberMetalCore.default.A();
this.forEach(function (k) {
@@ -33422,13 +33591,26 @@
return promise[name].apply(promise, arguments);
};
}
});
enifed('ember-runtime/mixins/registry_proxy', ['exports', 'ember-metal/core', 'ember-metal/mixin'], function (exports, _emberMetalCore, _emberMetalMixin) {
+ /**
+ @module ember
+ @submodule ember-runtime
+ */
+
'use strict';
exports.buildFakeRegistryWithDeprecations = buildFakeRegistryWithDeprecations;
+
+ /**
+ RegistryProxyMixin is used to provide public access to specific
+ registry functionality.
+
+ @class RegistryProxyMixin
+ @private
+ */
exports.default = _emberMetalMixin.Mixin.create({
__registry__: null,
/**
Given a fullName return the corresponding factory.
@@ -33476,12 +33658,11 @@
App.register('model:user', App.Person, { singleton: false });
App.register('fruit:favorite', App.Orange);
App.register('communication:main', App.Email, { singleton: false });
App.register('session', App.session, { instantiate: false });
```
- @public
- @method register
+ @method register
@param fullName {String} type:name (e.g., 'model:user')
@param factory {Function} (e.g., App.Person)
@param options {Object} (optional) disable instantiation or singleton usage
@public
*/
@@ -33654,11 +33835,16 @@
return fakeRegistry;
}
function buildFakeRegistryFunction(instance, typeForMessage, deprecatedProperty, nonDeprecatedProperty) {
return function () {
- _emberMetalCore.default.deprecate('Using `' + typeForMessage + '.registry.' + deprecatedProperty + '` is deprecated. Please use `' + typeForMessage + '.' + nonDeprecatedProperty + '` instead.', false, { id: 'ember-application.app-instance-registry', until: '3.0.0' });
+ _emberMetalCore.default.deprecate('Using `' + typeForMessage + '.registry.' + deprecatedProperty + '` is deprecated. Please use `' + typeForMessage + '.' + nonDeprecatedProperty + '` instead.', false, {
+ id: 'ember-application.app-instance-registry',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-application-registry-ember-applicationinstance-registry'
+ });
+
return instance[nonDeprecatedProperty].apply(instance, arguments);
};
}
});
enifed('ember-runtime/mixins/target_action_support', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/mixin', 'ember-metal/computed'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalMixin, _emberMetalComputed) {
@@ -34190,20 +34376,23 @@
enifed('ember-runtime/system/core_object', ['exports', 'ember-metal', 'ember-metal/features', 'ember-metal/merge', 'ember-metal/property_get', 'ember-metal/utils', 'ember-metal/meta', 'ember-metal/chains', 'ember-metal/events', 'ember-metal/mixin', 'ember-metal/error', 'ember-runtime/mixins/action_handler', 'ember-metal/properties', 'ember-metal/binding', 'ember-metal/computed', 'ember-metal/injected_property', 'ember-metal/run_loop', 'ember-metal/watching', 'ember-metal/core', 'ember-runtime/inject'], function (exports, _emberMetal, _emberMetalFeatures, _emberMetalMerge, _emberMetalProperty_get, _emberMetalUtils, _emberMetalMeta, _emberMetalChains, _emberMetalEvents, _emberMetalMixin, _emberMetalError, _emberRuntimeMixinsAction_handler, _emberMetalProperties, _emberMetalBinding, _emberMetalComputed, _emberMetalInjected_property, _emberMetalRun_loop, _emberMetalWatching, _emberMetalCore, _emberRuntimeInject) {
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
//
+ var _Mixin$create;
+
'REMOVE_USE_STRICT: true';
/**
@module ember
@submodule ember-runtime
*/
// using ember-metal/lib/main here to ensure that ember-debug is setup
// if present
-
+ var POST_INIT = _emberMetalUtils.symbol('POST_INIT');
+ exports.POST_INIT = POST_INIT;
var schedule = _emberMetalRun_loop.default.schedule;
var applyMixin = _emberMetalMixin.Mixin._apply;
var finishPartial = _emberMetalMixin.Mixin.finishPartial;
var reopen = _emberMetalMixin.Mixin.prototype.reopen;
var hasCachedComputedProperties = false;
@@ -34322,10 +34511,12 @@
args[x] = arguments[x];
}
this.init.apply(this, args);
}
+ this[POST_INIT]();
+
m.proto = proto;
_emberMetalChains.finishChains(this);
_emberMetalEvents.sendEvent(this, 'init');
};
@@ -34368,11 +34559,11 @@
*/
var CoreObject = makeCtor();
CoreObject.toString = function () {
return 'Ember.CoreObject';
};
- CoreObject.PrototypeMixin = _emberMetalMixin.Mixin.create({
+ CoreObject.PrototypeMixin = _emberMetalMixin.Mixin.create((_Mixin$create = {
reopen: function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
@@ -34401,185 +34592,45 @@
do important setup work, and you'll see strange behavior in your
application.
@method init
@public
*/
- init: function () {},
- __defineNonEnumerable: function (property) {
- Object.defineProperty(this, property.name, property.descriptor);
- //this[property.name] = property.descriptor.value;
- },
+ init: function () {}
- /**
- Defines the properties that will be concatenated from the superclass
- (instead of overridden).
- By default, when you extend an Ember class a property defined in
- the subclass overrides a property with the same name that is defined
- in the superclass. However, there are some cases where it is preferable
- to build up a property's value by combining the superclass' property
- value with the subclass' value. An example of this in use within Ember
- is the `classNames` property of `Ember.View`.
- Here is some sample code showing the difference between a concatenated
- property and a normal one:
- ```javascript
- App.BarView = Ember.View.extend({
- someNonConcatenatedProperty: ['bar'],
- classNames: ['bar']
- });
- App.FooBarView = App.BarView.extend({
- someNonConcatenatedProperty: ['foo'],
- classNames: ['foo']
- });
- var fooBarView = App.FooBarView.create();
- fooBarView.get('someNonConcatenatedProperty'); // ['foo']
- fooBarView.get('classNames'); // ['ember-view', 'bar', 'foo']
- ```
- This behavior extends to object creation as well. Continuing the
- above example:
- ```javascript
- var view = App.FooBarView.create({
- someNonConcatenatedProperty: ['baz'],
- classNames: ['baz']
- })
- view.get('someNonConcatenatedProperty'); // ['baz']
- view.get('classNames'); // ['ember-view', 'bar', 'foo', 'baz']
- ```
- Adding a single property that is not an array will just add it in the array:
- ```javascript
- var view = App.FooBarView.create({
- classNames: 'baz'
- })
- view.get('classNames'); // ['ember-view', 'bar', 'foo', 'baz']
- ```
- Using the `concatenatedProperties` property, we can tell Ember to mix the
- content of the properties.
- In `Ember.View` the `classNameBindings` and `attributeBindings` properties
- are also concatenated, in addition to `classNames`.
- This feature is available for you to use throughout the Ember object model,
- although typical app developers are likely to use it infrequently. Since
- it changes expectations about behavior of properties, you should properly
- document its usage in each individual concatenated property (to not
- mislead your users to think they can override the property in a subclass).
- @property concatenatedProperties
- @type Array
- @default null
- @public
- */
- concatenatedProperties: null,
+ }, _Mixin$create[POST_INIT] = function () {}, _Mixin$create.__defineNonEnumerable = function (property) {
+ Object.defineProperty(this, property.name, property.descriptor);
+ //this[property.name] = property.descriptor.value;
+ }, _Mixin$create.concatenatedProperties = null, _Mixin$create.mergedProperties = null, _Mixin$create.isDestroyed = false, _Mixin$create.isDestroying = false, _Mixin$create.destroy = function () {
+ if (this.isDestroying) {
+ return;
+ }
+ this.isDestroying = true;
- /**
- Destroyed object property flag.
- if this property is `true` the observers and bindings were already
- removed by the effect of calling the `destroy()` method.
- @property isDestroyed
- @default false
- @public
- */
- isDestroyed: false,
-
- /**
- Destruction scheduled flag. The `destroy()` method has been called.
- The object stays intact until the end of the run loop at which point
- the `isDestroyed` flag is set.
- @property isDestroying
- @default false
- @public
- */
- isDestroying: false,
-
- /**
- Destroys an object by setting the `isDestroyed` flag and removing its
- metadata, which effectively destroys observers and bindings.
- If you try to set a property on a destroyed object, an exception will be
- raised.
- Note that destruction is scheduled for the end of the run loop and does not
- happen immediately. It will set an isDestroying flag immediately.
- @method destroy
- @return {Ember.Object} receiver
- @public
- */
- destroy: function () {
- if (this.isDestroying) {
- return;
- }
- this.isDestroying = true;
-
- schedule('actions', this, this.willDestroy);
- schedule('destroy', this, this._scheduledDestroy);
- return this;
- },
-
- /**
- Override to implement teardown.
- @method willDestroy
- @public
- */
- willDestroy: _emberMetalCore.K,
-
- /**
- Invoked by the run loop to actually destroy the object. This is
- scheduled for execution by the `destroy` method.
- @private
- @method _scheduledDestroy
- */
- _scheduledDestroy: function () {
- if (this.isDestroyed) {
- return;
- }
- _emberMetalWatching.destroy(this);
- this.isDestroyed = true;
- },
-
- bind: function (to, from) {
- if (!(from instanceof _emberMetalBinding.Binding)) {
- from = _emberMetalBinding.Binding.from(from);
- }
- from.to(to).connect(this);
- return from;
- },
-
- /**
- Returns a string representation which attempts to provide more information
- than Javascript's `toString` typically does, in a generic way for all Ember
- objects.
- ```javascript
- App.Person = Em.Object.extend()
- person = App.Person.create()
- person.toString() //=> "<App.Person:ember1024>"
- ```
- If the object's class is not defined on an Ember namespace, it will
- indicate it is a subclass of the registered superclass:
- ```javascript
- Student = App.Person.extend()
- student = Student.create()
- student.toString() //=> "<(subclass of App.Person):ember1025>"
- ```
- If the method `toStringExtension` is defined, its return value will be
- included in the output.
- ```javascript
- App.Teacher = App.Person.extend({
- toStringExtension: function() {
- return this.get('fullName');
- }
- });
- teacher = App.Teacher.create()
- teacher.toString(); //=> "<App.Teacher:ember1026:Tom Dale>"
- ```
- @method toString
- @return {String} string representation
- @public
- */
- toString: function () {
- var hasToStringExtension = typeof this.toStringExtension === 'function';
- var extension = hasToStringExtension ? ':' + this.toStringExtension() : '';
- var ret = '<' + this.constructor.toString() + ':' + _emberMetalUtils.guidFor(this) + extension + '>';
-
- this.toString = makeToString(ret);
- return ret;
+ schedule('actions', this, this.willDestroy);
+ schedule('destroy', this, this._scheduledDestroy);
+ return this;
+ }, _Mixin$create.willDestroy = _emberMetalCore.K, _Mixin$create._scheduledDestroy = function () {
+ if (this.isDestroyed) {
+ return;
}
- });
+ _emberMetalWatching.destroy(this);
+ this.isDestroyed = true;
+ }, _Mixin$create.bind = function (to, from) {
+ if (!(from instanceof _emberMetalBinding.Binding)) {
+ from = _emberMetalBinding.Binding.from(from);
+ }
+ from.to(to).connect(this);
+ return from;
+ }, _Mixin$create.toString = function () {
+ var hasToStringExtension = typeof this.toStringExtension === 'function';
+ var extension = hasToStringExtension ? ':' + this.toStringExtension() : '';
+ var ret = '<' + this.constructor.toString() + ':' + _emberMetalUtils.guidFor(this) + extension + '>';
+ this.toString = makeToString(ret);
+ return ret;
+ }, _Mixin$create));
+
CoreObject.PrototypeMixin.ownerConstructor = CoreObject;
function makeToString(ret) {
return function () {
return ret;
@@ -34963,10 +35014,199 @@
// Ember.assert, Ember.config
// NOTE: this object should never be included directly. Instead use `Ember.Object`.
// We only define this separately so that `Ember.Set` can depend on it.
+
+/**
+ Defines the properties that will be concatenated from the superclass
+ (instead of overridden).
+ By default, when you extend an Ember class a property defined in
+ the subclass overrides a property with the same name that is defined
+ in the superclass. However, there are some cases where it is preferable
+ to build up a property's value by combining the superclass' property
+ value with the subclass' value. An example of this in use within Ember
+ is the `classNames` property of `Ember.View`.
+ Here is some sample code showing the difference between a concatenated
+ property and a normal one:
+ ```javascript
+ App.BarView = Ember.View.extend({
+ someNonConcatenatedProperty: ['bar'],
+ classNames: ['bar']
+ });
+ App.FooBarView = App.BarView.extend({
+ someNonConcatenatedProperty: ['foo'],
+ classNames: ['foo']
+ });
+ var fooBarView = App.FooBarView.create();
+ fooBarView.get('someNonConcatenatedProperty'); // ['foo']
+ fooBarView.get('classNames'); // ['ember-view', 'bar', 'foo']
+ ```
+ This behavior extends to object creation as well. Continuing the
+ above example:
+ ```javascript
+ var view = App.FooBarView.create({
+ someNonConcatenatedProperty: ['baz'],
+ classNames: ['baz']
+ })
+ view.get('someNonConcatenatedProperty'); // ['baz']
+ view.get('classNames'); // ['ember-view', 'bar', 'foo', 'baz']
+ ```
+ Adding a single property that is not an array will just add it in the array:
+ ```javascript
+ var view = App.FooBarView.create({
+ classNames: 'baz'
+ })
+ view.get('classNames'); // ['ember-view', 'bar', 'foo', 'baz']
+ ```
+ Using the `concatenatedProperties` property, we can tell Ember to mix the
+ content of the properties.
+ In `Ember.View` the `classNameBindings` and `attributeBindings` properties
+ are also concatenated, in addition to `classNames`.
+ This feature is available for you to use throughout the Ember object model,
+ although typical app developers are likely to use it infrequently. Since
+ it changes expectations about behavior of properties, you should properly
+ document its usage in each individual concatenated property (to not
+ mislead your users to think they can override the property in a subclass).
+ @property concatenatedProperties
+ @type Array
+ @default null
+ @public
+*/
+
+/**
+ Defines the properties that will be merged from the superclass
+ (instead of overridden).
+ By default, when you extend an Ember class a property defined in
+ the subclass overrides a property with the same name that is defined
+ in the superclass. However, there are some cases where it is preferable
+ to build up a property's value by merging the superclass property value
+ with the subclass property's value. An example of this in use within Ember
+ is the `queryParams` property of routes.
+ Here is some sample code showing the difference between a merged
+ property and a normal one:
+ ```javascript
+ App.BarRoute = Ember.Route.extend({
+ someNonMergedProperty: {
+ nonMerged: 'superclass value of nonMerged'
+ },
+ queryParams: {
+ page: {replace: false},
+ limit: {replace: true}
+ }
+ });
+ App.FooBarRoute = App.BarRoute.extend({
+ someNonMergedProperty: {
+ completelyNonMerged: 'subclass value of nonMerged'
+ },
+ queryParams: {
+ limit: {replace: false}
+ }
+ });
+ var fooBarRoute = App.FooBarRoute.create();
+ fooBarRoute.get('someNonMergedProperty');
+ // => { completelyNonMerged: 'subclass value of nonMerged' }
+ //
+ // Note the entire object, including the nonMerged property of
+ // the superclass object, has been replaced
+ fooBarRoute.get('queryParams');
+ // => {
+ // page: {replace: false},
+ // limit: {replace: false}
+ // }
+ //
+ // Note the page remains from the superclass, and the
+ // `limit` property's value of `false` has been merged from
+ // the subclass.
+ ```
+ This behavior is not available during object `create` calls. It is only
+ available at `extend` time.
+ This feature is available for you to use throughout the Ember object model,
+ although typical app developers are likely to use it infrequently. Since
+ it changes expectations about behavior of properties, you should properly
+ document its usage in each individual merged property (to not
+ mislead your users to think they can override the property in a subclass).
+ @property mergedProperties
+ @type Array
+ @default null
+ @public
+*/
+
+/**
+ Destroyed object property flag.
+ if this property is `true` the observers and bindings were already
+ removed by the effect of calling the `destroy()` method.
+ @property isDestroyed
+ @default false
+ @public
+*/
+
+/**
+ Destruction scheduled flag. The `destroy()` method has been called.
+ The object stays intact until the end of the run loop at which point
+ the `isDestroyed` flag is set.
+ @property isDestroying
+ @default false
+ @public
+*/
+
+/**
+ Destroys an object by setting the `isDestroyed` flag and removing its
+ metadata, which effectively destroys observers and bindings.
+ If you try to set a property on a destroyed object, an exception will be
+ raised.
+ Note that destruction is scheduled for the end of the run loop and does not
+ happen immediately. It will set an isDestroying flag immediately.
+ @method destroy
+ @return {Ember.Object} receiver
+ @public
+*/
+
+/**
+ Override to implement teardown.
+ @method willDestroy
+ @public
+*/
+
+/**
+ Invoked by the run loop to actually destroy the object. This is
+ scheduled for execution by the `destroy` method.
+ @private
+ @method _scheduledDestroy
+*/
+
+/**
+ Returns a string representation which attempts to provide more information
+ than Javascript's `toString` typically does, in a generic way for all Ember
+ objects.
+ ```javascript
+ App.Person = Em.Object.extend()
+ person = App.Person.create()
+ person.toString() //=> "<App.Person:ember1024>"
+ ```
+ If the object's class is not defined on an Ember namespace, it will
+ indicate it is a subclass of the registered superclass:
+ ```javascript
+ Student = App.Person.extend()
+ student = Student.create()
+ student.toString() //=> "<(subclass of App.Person):ember1025>"
+ ```
+ If the method `toStringExtension` is defined, its return value will be
+ included in the output.
+ ```javascript
+ App.Teacher = App.Person.extend({
+ toStringExtension: function() {
+ return this.get('fullName');
+ }
+ });
+ teacher = App.Teacher.create()
+ teacher.toString(); //=> "<App.Teacher:ember1026:Tom Dale>"
+ ```
+ @method toString
+ @return {String} string representation
+ @public
+*/
enifed('ember-runtime/system/each_proxy', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/observer', 'ember-metal/property_events', 'ember-metal/empty_object'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalObserver, _emberMetalProperty_events, _emberMetalEmpty_object) {
'use strict';
/**
This is the object instance returned when you get the `@each` property on an
@@ -35743,17 +35983,26 @@
}).replace(STRING_CAMELIZE_REGEXP_2, function (match, separator, chr) {
return match.toLowerCase();
});
});
- var STRING_CLASSIFY_REGEXP_1 = /(\-|\_|\.|\s)+(.)?/g;
- var STRING_CLASSIFY_REGEXP_2 = /(^|\/|\.)([a-z])/g;
+ var STRING_CLASSIFY_REGEXP_1 = /^(\-|_)+(.)?/;
+ var STRING_CLASSIFY_REGEXP_2 = /(.)(\-|\_|\.|\s)+(.)?/g;
+ var STRING_CLASSIFY_REGEXP_3 = /(^|\/|\.)([a-z])/g;
var CLASSIFY_CACHE = new _emberMetalCache.default(1000, function (str) {
- return str.replace(STRING_CLASSIFY_REGEXP_1, function (match, separator, chr) {
- return chr ? chr.toUpperCase() : '';
- }).replace(STRING_CLASSIFY_REGEXP_2, function (match, separator, chr) {
+ var replace1 = function (match, separator, chr) {
+ return chr ? '_' + chr.toUpperCase() : '';
+ };
+ var replace2 = function (match, initialChar, separator, chr) {
+ return initialChar + (chr ? chr.toUpperCase() : '');
+ };
+ var parts = str.split('/');
+ for (var i = 0, len = parts.length; i < len; i++) {
+ parts[i] = parts[i].replace(STRING_CLASSIFY_REGEXP_1, replace1).replace(STRING_CLASSIFY_REGEXP_2, replace2);
+ }
+ return parts.join('/').replace(STRING_CLASSIFY_REGEXP_3, function (match, separator, chr) {
return match.toUpperCase();
});
});
var STRING_UNDERSCORE_REGEXP_1 = /([a-z\d])([A-Z]+)/g;
@@ -37200,11 +37449,11 @@
options.plugins = plugins;
options.buildMeta = function buildMeta(program) {
return {
topLevel: detectTopLevel(program),
- revision: 'Ember@2.1.0-beta.3',
+ revision: 'Ember@2.1.0',
loc: program.loc,
moduleName: options.moduleName
};
};
@@ -40825,11 +41074,11 @@
return result;
},
_bubbleEvent: function (view, evt, eventName) {
- return _emberMetalRun_loop.default.join(view, view.handleEvent, eventName, evt);
+ return view.handleEvent(eventName, evt);
},
destroy: function () {
var rootElement = _emberMetalProperty_get.get(this, 'rootElement');
_emberViewsSystemJquery.default(rootElement).off('.ember', '**').removeClass('ember-application');
@@ -41653,11 +41902,15 @@
// If a `defaultLayout` was specified move it to the `layout` prop.
// `layout` is no longer a CP, so this just ensures that the `defaultLayout`
// logic is supported with a deprecation
if (this.defaultLayout && !this.layout) {
- _emberMetalCore.default.deprecate('Specifying `defaultLayout` to ' + this + ' is deprecated. Please use `layout` instead.', false, { id: 'ember-views.component.defaultLayout', until: '3.0.0' });
+ _emberMetalCore.default.deprecate('Specifying `defaultLayout` to ' + this + ' is deprecated. Please use `layout` instead.', false, {
+ id: 'ember-views.component.defaultLayout',
+ until: '3.0.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-component-defaultlayout'
+ });
this.layout = this.defaultLayout;
}
},
@@ -41813,29 +42066,47 @@
Returns true when the component was invoked with a block template.
Example (`hasBlock` will be `false`):
```hbs
{{! templates/application.hbs }}
{{foo-bar}}
- {{! templates/components/foo-bar.js }}
+ {{! templates/components/foo-bar.hbs }}
{{#if hasBlock}}
This will not be printed, because no block was provided
{{/if}}
```
Example (`hasBlock` will be `true`):
```hbs
{{! templates/application.hbs }}
{{#foo-bar}}
Hi!
{{/foo-bar}}
- {{! templates/components/foo-bar.js }}
+ {{! templates/components/foo-bar.hbs }}
{{#if hasBlock}}
This will be printed because a block was provided
{{yield}}
{{/if}}
```
+ This helper accepts an argument with the name of the block we want to check the presence of.
+ This is useful for checking for the presence of the optional inverse block in components.
+ ```hbs
+ {{! templates/application.hbs }}
+ {{#foo-bar}}
+ Hi!
+ {{else}}
+ What's up?
+ {{/foo-bar}}
+ {{! templates/components/foo-bar.hbs }}
+ {{yield}}
+ {{#if (hasBlock "inverse")}}
+ {{yield to="inverse"}}
+ {{else}}
+ How are you?
+ {{/if}}
+ ```
@public
@property hasBlock
+ @param {String} [blockName="default"] The name of the block to check presence of.
@returns Boolean
*/
/**
Returns true when the component was invoked with a block parameter
@@ -41844,11 +42115,11 @@
```hbs
{{! templates/application.hbs }}
{{#foo-bar}}
No block parameter.
{{/foo-bar}}
- {{! templates/components/foo-bar.js }}
+ {{! templates/components/foo-bar.hbs }}
{{#if hasBlockParams}}
This will not be printed, because no block was provided
{{yield this}}
{{/if}}
```
@@ -41856,11 +42127,11 @@
```hbs
{{! templates/application.hbs }}
{{#foo-bar as |foo|}}
Hi!
{{/foo-bar}}
- {{! templates/components/foo-bar.js }}
+ {{! templates/components/foo-bar.hbs }}
{{#if hasBlockParams}}
This will be printed because a block was provided
{{yield this}}
{{/if}}
```
@@ -41916,11 +42187,11 @@
exports.default = Component;
});
enifed('ember-views/views/container_view', ['exports', 'ember-metal/core', 'ember-runtime/mixins/mutable_array', 'ember-views/views/view', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/mixin', 'ember-metal/events', 'ember-htmlbars/templates/container-view'], function (exports, _emberMetalCore, _emberRuntimeMixinsMutable_array, _emberViewsViewsView, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalMixin, _emberMetalEvents, _emberHtmlbarsTemplatesContainerView) {
'use strict';
- _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.1.0-beta.3';
+ _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.1.0';
/**
@module ember
@submodule ember-views
*/
@@ -43180,11 +43451,11 @@
}
});
exports.default = destroying;
});
-enifed('ember-views/views/states/has_element', ['exports', 'ember-views/views/states/default', 'ember-metal/merge', 'ember-views/system/jquery', 'ember-metal/property_get', 'htmlbars-runtime'], function (exports, _emberViewsViewsStatesDefault, _emberMetalMerge, _emberViewsSystemJquery, _emberMetalProperty_get, _htmlbarsRuntime) {
+enifed('ember-views/views/states/has_element', ['exports', 'ember-views/views/states/default', 'ember-metal/merge', 'ember-views/system/jquery', 'ember-metal/run_loop', 'ember-metal/property_get', 'htmlbars-runtime'], function (exports, _emberViewsViewsStatesDefault, _emberMetalMerge, _emberViewsSystemJquery, _emberMetalRun_loop, _emberMetalProperty_get, _htmlbarsRuntime) {
'use strict';
var hasElement = Object.create(_emberViewsViewsStatesDefault.default);
_emberMetalMerge.default(hasElement, {
@@ -43238,11 +43509,11 @@
// Handle events from `Ember.EventDispatcher`
handleEvent: function (view, eventName, evt) {
if (view.has(eventName)) {
// Handler should be able to re-dispatch events, so we don't
// preventDefault or stopPropagation.
- return view.trigger(eventName, evt);
+ return _emberMetalRun_loop.default.join(view, view.trigger, eventName, evt);
} else {
return true; // continue event propagation
}
},
@@ -43473,17 +43744,21 @@
@public
*/
max: null
});
});
-enifed('ember-views/views/view', ['exports', 'ember-metal/core', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/run_loop', 'ember-metal/observer', 'ember-metal/utils', 'ember-metal/computed', 'ember-metal/mixin', 'ember-views/system/jquery', 'ember-views/system/ext', 'ember-views/views/core_view', 'ember-views/mixins/view_context_support', 'ember-views/mixins/view_child_views_support', 'ember-views/mixins/view_state_support', 'ember-views/mixins/template_rendering_support', 'ember-views/mixins/class_names_support', 'ember-views/mixins/legacy_view_support', 'ember-views/mixins/instrumentation_support', 'ember-views/mixins/aria_role_support', 'ember-views/mixins/visibility_support', 'ember-views/compat/attrs-proxy', 'ember-metal/deprecate_property'], function (exports, _emberMetalCore, _emberMetalError, _emberMetalProperty_get, _emberMetalRun_loop, _emberMetalObserver, _emberMetalUtils, _emberMetalComputed, _emberMetalMixin, _emberViewsSystemJquery, _emberViewsSystemExt, _emberViewsViewsCore_view, _emberViewsMixinsView_context_support, _emberViewsMixinsView_child_views_support, _emberViewsMixinsView_state_support, _emberViewsMixinsTemplate_rendering_support, _emberViewsMixinsClass_names_support, _emberViewsMixinsLegacy_view_support, _emberViewsMixinsInstrumentation_support, _emberViewsMixinsAria_role_support, _emberViewsMixinsVisibility_support, _emberViewsCompatAttrsProxy, _emberMetalDeprecate_property) {
+enifed('ember-views/views/view', ['exports', 'ember-metal/core', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/run_loop', 'ember-metal/observer', 'ember-metal/utils', 'ember-metal/computed', 'ember-metal/mixin', 'ember-views/system/jquery', 'ember-views/system/ext', 'ember-views/views/core_view', 'ember-views/mixins/view_context_support', 'ember-views/mixins/view_child_views_support', 'ember-views/mixins/view_state_support', 'ember-views/mixins/template_rendering_support', 'ember-views/mixins/class_names_support', 'ember-views/mixins/legacy_view_support', 'ember-views/mixins/instrumentation_support', 'ember-views/mixins/aria_role_support', 'ember-views/mixins/visibility_support', 'ember-views/compat/attrs-proxy', 'ember-metal/deprecate_property', 'ember-runtime/system/core_object'], function (exports, _emberMetalCore, _emberMetalError, _emberMetalProperty_get, _emberMetalRun_loop, _emberMetalObserver, _emberMetalUtils, _emberMetalComputed, _emberMetalMixin, _emberViewsSystemJquery, _emberViewsSystemExt, _emberViewsViewsCore_view, _emberViewsMixinsView_context_support, _emberViewsMixinsView_child_views_support, _emberViewsMixinsView_state_support, _emberViewsMixinsTemplate_rendering_support, _emberViewsMixinsClass_names_support, _emberViewsMixinsLegacy_view_support, _emberViewsMixinsInstrumentation_support, _emberViewsMixinsAria_role_support, _emberViewsMixinsVisibility_support, _emberViewsCompatAttrsProxy, _emberMetalDeprecate_property, _emberRuntimeSystemCore_object) {
// Ember.assert, Ember.deprecate, Ember.warn, Ember.TEMPLATES,
// jQuery, Ember.lookup,
// Ember.ContainerView circular dependency
// Ember.ENV
'use strict';
+ var _CoreView$extend;
+
+ var INIT_WAS_CALLED = _emberMetalUtils.symbol('INIT_WAS_CALLED');
+
function K() {
return this;
}
/**
@@ -44117,11 +44392,11 @@
@uses Ember.VisibilitySupport
@uses Ember.AriaRoleSupport
@public
*/
// jscs:disable validateIndentation
- var View = _emberViewsViewsCore_view.default.extend(_emberViewsMixinsView_context_support.default, _emberViewsMixinsView_child_views_support.default, _emberViewsMixinsView_state_support.default, _emberViewsMixinsTemplate_rendering_support.default, _emberViewsMixinsClass_names_support.default, _emberViewsMixinsLegacy_view_support.default, _emberViewsMixinsInstrumentation_support.default, _emberViewsMixinsVisibility_support.default, _emberViewsCompatAttrsProxy.default, _emberViewsMixinsAria_role_support.default, {
+ var View = _emberViewsViewsCore_view.default.extend(_emberViewsMixinsView_context_support.default, _emberViewsMixinsView_child_views_support.default, _emberViewsMixinsView_state_support.default, _emberViewsMixinsTemplate_rendering_support.default, _emberViewsMixinsClass_names_support.default, _emberViewsMixinsLegacy_view_support.default, _emberViewsMixinsInstrumentation_support.default, _emberViewsMixinsVisibility_support.default, _emberViewsCompatAttrsProxy.default, _emberViewsMixinsAria_role_support.default, (_CoreView$extend = {
concatenatedProperties: ['attributeBindings'],
/**
@property isView
@type Boolean
@@ -44685,180 +44960,125 @@
dispatch
@method init
@private
*/
init: function () {
+ this._super.apply(this, arguments);
+
if (!this.elementId) {
this.elementId = _emberMetalUtils.guidFor(this);
}
this.scheduledRevalidation = false;
- this._super.apply(this, arguments);
+ this[INIT_WAS_CALLED] = true;
if (!this._viewRegistry) {
this._viewRegistry = View.views;
}
- this.renderer.componentInitAttrs(this, this.attrs || {});
-
_emberMetalCore.default.assert('Using a custom `.render` function is no longer supported.', !this.render);
- },
+ }
- __defineNonEnumerable: function (property) {
- this[property.name] = property.descriptor.value;
- },
+ }, _CoreView$extend[_emberRuntimeSystemCore_object.POST_INIT] = function () {
+ this._super.apply(this, arguments);
- revalidate: function () {
- this.renderer.revalidateTopLevelView(this);
- this.scheduledRevalidation = false;
- },
+ _emberMetalCore.default.assert('You must call `this._super(...arguments);` when implementing `init` in a component. Please update ' + this + ' to call `this._super` from `init`.', this[INIT_WAS_CALLED]);
- scheduleRevalidate: function (node, label, manualRerender) {
- if (node && !this._dispatching && node.guid in this.env.renderedNodes) {
- if (manualRerender) {
- _emberMetalCore.default.deprecate('You manually rerendered ' + label + ' (a parent component) from a child component during the rendering process. This rarely worked in Ember 1.x and will be removed in Ember 2.0', false, { id: 'ember-views.manual-parent-rerender', until: '3.0.0' });
- } else {
- _emberMetalCore.default.deprecate('You modified ' + label + ' twice in a single render. This was unreliable in Ember 1.x and will be removed in Ember 2.0', false, { id: 'ember-views.render-double-modify', until: '3.0.0' });
- }
- _emberMetalRun_loop.default.scheduleOnce('render', this, this.revalidate);
- return;
+ this.renderer.componentInitAttrs(this, this.attrs || {});
+ }, _CoreView$extend.__defineNonEnumerable = function (property) {
+ this[property.name] = property.descriptor.value;
+ }, _CoreView$extend.revalidate = function () {
+ this.renderer.revalidateTopLevelView(this);
+ this.scheduledRevalidation = false;
+ }, _CoreView$extend.scheduleRevalidate = function (node, label, manualRerender) {
+ if (node && !this._dispatching && node.guid in this.env.renderedNodes) {
+ if (manualRerender) {
+ _emberMetalCore.default.deprecate('You manually rerendered ' + label + ' (a parent component) from a child component during the rendering process. This rarely worked in Ember 1.x and will be removed in Ember 2.0', false, { id: 'ember-views.manual-parent-rerender', until: '3.0.0' });
+ } else {
+ _emberMetalCore.default.deprecate('You modified ' + label + ' twice in a single render. This was unreliable in Ember 1.x and will be removed in Ember 2.0', false, { id: 'ember-views.render-double-modify', until: '3.0.0' });
}
+ _emberMetalRun_loop.default.scheduleOnce('render', this, this.revalidate);
+ return;
+ }
- _emberMetalCore.default.deprecate('A property of ' + this + ' was modified inside the ' + this._dispatching + ' hook. You should never change properties on components, services or models during ' + this._dispatching + ' because it causes significant performance degradation.', !this._dispatching, { id: 'ember-views.dispatching-modify-property', until: '3.0.0' });
+ _emberMetalCore.default.deprecate('A property of ' + this + ' was modified inside the ' + this._dispatching + ' hook. You should never change properties on components, services or models during ' + this._dispatching + ' because it causes significant performance degradation.', !this._dispatching, { id: 'ember-views.dispatching-modify-property', until: '3.0.0' });
- if (!this.scheduledRevalidation || this._dispatching) {
- this.scheduledRevalidation = true;
- _emberMetalRun_loop.default.scheduleOnce('render', this, this.revalidate);
- }
- },
+ if (!this.scheduledRevalidation || this._dispatching) {
+ this.scheduledRevalidation = true;
+ _emberMetalRun_loop.default.scheduleOnce('render', this, this.revalidate);
+ }
+ }, _CoreView$extend.templateRenderer = null, _CoreView$extend.removeFromParent = function () {
+ var parent = this.parentView;
- templateRenderer: null,
+ // Remove DOM element from parent
+ this.remove();
- /**
- Removes the view from its `parentView`, if one is found. Otherwise
- does nothing.
- @method removeFromParent
- @return {Ember.View} receiver
- @private
- */
- removeFromParent: function () {
- var parent = this.parentView;
+ if (parent) {
+ parent.removeChild(this);
+ }
+ return this;
+ }, _CoreView$extend.destroy = function () {
+ // get parentView before calling super because it'll be destroyed
+ var parentView = this.parentView;
+ var viewName = this.viewName;
- // Remove DOM element from parent
- this.remove();
+ if (!this._super.apply(this, arguments)) {
+ return;
+ }
- if (parent) {
- parent.removeChild(this);
- }
- return this;
- },
+ // remove from non-virtual parent view if viewName was specified
+ if (viewName && parentView) {
+ parentView.set(viewName, null);
+ }
- /**
- You must call `destroy` on a view to destroy the view (and all of its
- child views). This will remove the view from any parent node, then make
- sure that the DOM element managed by the view can be released by the
- memory manager.
- @method destroy
- @private
- */
- destroy: function () {
- // get parentView before calling super because it'll be destroyed
- var parentView = this.parentView;
- var viewName = this.viewName;
+ // Destroy HTMLbars template
+ if (this.lastResult) {
+ this.lastResult.destroy();
+ }
- if (!this._super.apply(this, arguments)) {
- return;
- }
+ return this;
+ }, _CoreView$extend.handleEvent = function (eventName, evt) {
+ return this._currentState.handleEvent(this, eventName, evt);
+ }, _CoreView$extend._register = function () {
+ _emberMetalCore.default.assert('Attempted to register a view with an id already in use: ' + this.elementId, !this._viewRegistry[this.elementId]);
+ this._viewRegistry[this.elementId] = this;
+ }, _CoreView$extend._unregister = function () {
+ delete this._viewRegistry[this.elementId];
+ }, _CoreView$extend.registerObserver = function (root, path, target, observer) {
+ if (!observer && 'function' === typeof target) {
+ observer = target;
+ target = null;
+ }
- // remove from non-virtual parent view if viewName was specified
- if (viewName && parentView) {
- parentView.set(viewName, null);
- }
+ if (!root || typeof root !== 'object') {
+ return;
+ }
- // Destroy HTMLbars template
- if (this.lastResult) {
- this.lastResult.destroy();
- }
+ var scheduledObserver = this._wrapAsScheduled(observer);
- return this;
- },
+ _emberMetalObserver.addObserver(root, path, target, scheduledObserver);
- // .......................................................
- // EVENT HANDLING
- //
-
- /**
- Handle events from `Ember.EventDispatcher`
- @method handleEvent
- @param eventName {String}
- @param evt {Event}
- @private
- */
- handleEvent: function (eventName, evt) {
- return this._currentState.handleEvent(this, eventName, evt);
- },
-
- /**
- Registers the view in the view registry, keyed on the view's `elementId`.
- This is used by the EventDispatcher to locate the view in response to
- events.
- This method should only be called once the view has been inserted into the
- DOM.
- @method _register
- @private
- */
- _register: function () {
- _emberMetalCore.default.assert('Attempted to register a view with an id already in use: ' + this.elementId, !this._viewRegistry[this.elementId]);
- this._viewRegistry[this.elementId] = this;
- },
-
- /**
- Removes the view from the view registry. This should be called when the
- view is removed from DOM.
- @method _unregister
- @private
- */
- _unregister: function () {
- delete this._viewRegistry[this.elementId];
- },
-
- registerObserver: function (root, path, target, observer) {
- if (!observer && 'function' === typeof target) {
- observer = target;
- target = null;
- }
-
- if (!root || typeof root !== 'object') {
- return;
- }
-
- var scheduledObserver = this._wrapAsScheduled(observer);
-
- _emberMetalObserver.addObserver(root, path, target, scheduledObserver);
-
- this.one('willClearRender', function () {
- _emberMetalObserver.removeObserver(root, path, target, scheduledObserver);
- });
- },
-
- _wrapAsScheduled: function (fn) {
- var view = this;
- var stateCheckedFn = function () {
- view._currentState.invokeObserver(this, fn);
- };
- var scheduledFn = function () {
- _emberMetalRun_loop.default.scheduleOnce('render', this, stateCheckedFn);
- };
- return scheduledFn;
- }
- });
+ this.one('willClearRender', function () {
+ _emberMetalObserver.removeObserver(root, path, target, scheduledObserver);
+ });
+ }, _CoreView$extend._wrapAsScheduled = function (fn) {
+ var view = this;
+ var stateCheckedFn = function () {
+ view._currentState.invokeObserver(this, fn);
+ };
+ var scheduledFn = function () {
+ _emberMetalRun_loop.default.scheduleOnce('render', this, stateCheckedFn);
+ };
+ return scheduledFn;
+ }, _CoreView$extend));
// jscs:enable validateIndentation
_emberMetalDeprecate_property.deprecateProperty(View.prototype, 'currentState', '_currentState', {
id: 'ember-view.current-state',
- until: '2.3.0'
+ until: '2.3.0',
+ url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-component-currentstate'
});
/*
Describe how the specified actions should behave in the various
states that a view can exist in. Possible states:
@@ -44932,9 +45152,64 @@
exports.TemplateRenderingSupport = _emberViewsMixinsTemplate_rendering_support.default;
exports.ClassNamesSupport = _emberViewsMixinsClass_names_support.default;
exports.DeprecatedView = DeprecatedView;
});
// for the side effect of extending Ember.run.queues
+
+/*
+ This is a special hook implemented in CoreObject, that allows Views/Components
+ to have a way to ensure that `init` fires before `didInitAttrs` / `didReceiveAttrs`
+ (so that `this._super` in init does not trigger `didReceiveAttrs` before the classes
+ own `init` is finished).
+ @method __postInitInitialization
+ @private
+ */
+
+/**
+ Removes the view from its `parentView`, if one is found. Otherwise
+ does nothing.
+ @method removeFromParent
+ @return {Ember.View} receiver
+ @private
+*/
+
+/**
+ You must call `destroy` on a view to destroy the view (and all of its
+ child views). This will remove the view from any parent node, then make
+ sure that the DOM element managed by the view can be released by the
+ memory manager.
+ @method destroy
+ @private
+*/
+
+// .......................................................
+// EVENT HANDLING
+//
+
+/**
+ Handle events from `Ember.EventDispatcher`
+ @method handleEvent
+ @param eventName {String}
+ @param evt {Event}
+ @private
+*/
+
+/**
+ Registers the view in the view registry, keyed on the view's `elementId`.
+ This is used by the EventDispatcher to locate the view in response to
+ events.
+ This method should only be called once the view has been inserted into the
+ DOM.
+ @method _register
+ @private
+*/
+
+/**
+ Removes the view from the view registry. This should be called when the
+ view is removed from DOM.
+ @method _unregister
+ @private
+*/
enifed('ember', ['exports', 'ember-metal', 'ember-runtime', 'ember-views', 'ember-routing', 'ember-application', 'ember-extension-support', 'ember-htmlbars', 'ember-routing-htmlbars', 'ember-routing-views', 'ember-metal/core', 'ember-runtime/system/lazy_load'], function (exports, _emberMetal, _emberRuntime, _emberViews, _emberRouting, _emberApplication, _emberExtensionSupport, _emberHtmlbars, _emberRoutingHtmlbars, _emberRoutingViews, _emberMetalCore, _emberRuntimeSystemLazy_load) {
// require the main entry points for each of these packages
// this is so that the global exports occur properly
'use strict';
\ No newline at end of file