dist/ember-template-compiler.js in ember-source-2.16.0 vs dist/ember-template-compiler.js in ember-source-2.16.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.16.0
+ * @version 2.16.1
*/
var enifed, requireModule, Ember;
var mainContext = this; // Used in ember-environment/lib/global.js
@@ -1262,11 +1262,11 @@
if (expr.this) {
this.opcode('get', expr, 0, expr.parts);
} else if (symbols.has(head)) {
this.opcode('get', expr, symbols.get(head), expr.parts.slice(1));
} else {
- this.opcode('get', expr, 0, expr.parts);
+ this.opcode('maybeLocal', expr, expr.parts);
}
}
};
TemplateCompiler.prototype.StringLiteral = function (action) {
@@ -6676,14 +6676,13 @@
'use strict';
exports.missingOptionsUntilDeprecation = exports.missingOptionsIdDeprecation = exports.missingOptionsDeprecation = exports.registerHandler = undefined;
/**
- @module ember
- @submodule ember-debug
+ @module @ember/debug
+ @public
*/
-
/**
Allows for runtime registration of handler functions that override the default deprecation behavior.
Deprecations are invoked by calls to [Ember.deprecate](https://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.
@@ -6712,11 +6711,11 @@
</ul>
@public
@static
@method registerDeprecationHandler
- @for Ember.Debug
+ @for @ember/debug
@param handler {Function} A function to handle deprecation calls.
@since 2.1.0
*/
var registerHandler = function () {}; /*global __fail__*/
@@ -6810,17 +6809,21 @@
});
exports.missingOptionsDeprecation = missingOptionsDeprecation = 'When calling `Ember.deprecate` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include `id` and `until` properties.';
exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation = 'When calling `Ember.deprecate` you must provide `id` in options.';
exports.missingOptionsUntilDeprecation = missingOptionsUntilDeprecation = 'When calling `Ember.deprecate` you must provide `until` in options.';
-
/**
+ @module @ember/application
+ @public
+ */
+ /**
Display a deprecation warning with the provided message and a stack trace
(Chrome and Firefox only).
* In a production build, this method is defined as an empty function (NOP).
Uses of this method in Ember itself are stripped from the ember.prod.js build.
@method deprecate
+ @for @ember/application/deprecations
@param {String} message A description of the deprecation.
@param {Boolean} test A boolean. If falsy, the deprecation will be displayed.
@param {Object} options
@param {String} options.id A unique id for this deprecation. The id can be
used by Ember debugging tools to change the behavior (raise, log or silence)
@@ -6828,11 +6831,11 @@
"view.helper.select".
@param {string} options.until The version of Ember when this deprecation
warning will be removed.
@param {String} [options.url] An optional url to the transition guide on the
emberjs.com website.
- @for Ember
+ @static
@public
@since 1.0.0
*/
deprecate = function deprecate(message, test, options) {
if (!options || !options.id && !options.until) {
@@ -6871,14 +6874,17 @@
});
enifed("ember-debug/error", ["exports", "ember-babel"], function (exports, _emberBabel) {
"use strict";
/**
+ @module @ember/error
+ */
+
+ /**
A subclass of the JavaScript Error object for use in Ember.
- @class Error
- @namespace Ember
+ @class EmberError
@extends Error
@constructor
@public
*/
@@ -6924,10 +6930,14 @@
'use strict';
exports.default =
/**
+ @module ember
+ */
+
+ /**
The hash of enabled Canary features. Add to this, any canary features
before creating your application.
Alternatively (and recommended), you can also define `EmberENV.FEATURES`
if you need to enable features flagged at runtime.
@@ -7111,30 +7121,27 @@
return deprecateFunc;
}
};
/**
- @module ember
- @submodule ember-debug
+ @module @ember/debug
*/
/**
- @class Ember
- @public
- */
-
- /**
Define an assertion that will throw an exception if the condition is not met.
* In a production build, this method is defined as an empty function (NOP).
Uses of this method in Ember itself are stripped from the ember.prod.js build.
```javascript
- // Test for truthiness
- Ember.assert('Must pass a valid object', obj);
+ import { assert } from '@ember/debug';
+ // Test for truthiness
+ assert('Must pass a valid object', obj);
// Fail unconditionally
- Ember.assert('This code path should never be run');
+ assert('This code path should never be run');
```
@method assert
+ @static
+ @for @ember/debug
@param {String} desc A description of the assertion. This will become
the text of the Error thrown if the assertion fails.
@param {Boolean} test Must be truthy for the assertion to pass. If
falsy, an exception will be thrown.
@public
@@ -7149,13 +7156,16 @@
/**
Display a debug notice.
* In a production build, this method is defined as an empty function (NOP).
Uses of this method in Ember itself are stripped from the ember.prod.js build.
```javascript
- Ember.debug('I\'m a debug notice!');
+ import { debug } from '@ember/debug';
+ debug('I\'m a debug notice!');
```
@method debug
+ @for @ember/debug
+ @static
@param {String} message A debug message to display.
@public
*/
setDebugFunction('debug', function (message) {
_emberConsole.default.debug('DEBUG: ' + message);
@@ -7171,18 +7181,25 @@
setDebugFunction('info', function () {
_emberConsole.default.info.apply(undefined, arguments);
});
/**
+ @module @ember/application
+ @public
+ */
+
+ /**
Alias an old, deprecated method with its new counterpart.
Display a deprecation warning with the provided message and a stack trace
(Chrome and Firefox only) when the assigned method is called.
* In a production build, this method is defined as an empty function (NOP).
```javascript
Ember.oldMethod = Ember.deprecateFunc('Please use the new, updated method', Ember.newMethod);
```
@method deprecateFunc
+ @static
+ @for @ember/application/deprecations
@param {String} message A description of the deprecation.
@param {Object} [options] The options object for Ember.deprecate.
@param {Function} func The new function called to replace its deprecated counterpart.
@return {Function} A new function that wraps the original function with a deprecation warning
@private
@@ -7212,23 +7229,31 @@
};
}
});
/**
+ @module @ember/debug
+ @public
+ */
+ /**
Run a function meant for debugging.
* In a production build, this method is defined as an empty function (NOP).
Uses of this method in Ember itself are stripped from the ember.prod.js build.
```javascript
- Ember.runInDebug(() => {
- Ember.Component.reopen({
+ import Component from '@ember/component';
+ import { runInDebug } from '@ember/debug';
+ runInDebug(() => {
+ Component.reopen({
didInsertElement() {
console.log("I'm happy");
}
});
});
```
@method runInDebug
+ @for @ember/debug
+ @static
@param {Function} func The function to be executed.
@since 1.5.0
@public
*/
setDebugFunction('runInDebug', function (func) {
@@ -7250,11 +7275,11 @@
var _warnIfUsingStrippedFeatureFlags = void 0;
if (true && !(0, _testing.isTesting)()) {
/**
- Will call `Ember.warn()` if ENABLE_OPTIONAL_FEATURES or
+ Will call `warn()` if ENABLE_OPTIONAL_FEATURES or
any specific FEATURES flag is truthy.
This method is called automatically in debug canary builds.
@private
@method _warnIfUsingStrippedFeatureFlags
@return {void}
@@ -7349,22 +7374,22 @@
var warn = function () {};
var missingOptionsDeprecation = void 0,
missingOptionsIdDeprecation = void 0;
/**
- @module ember
- @submodule ember-debug
+ @module @ember/debug
*/
/**
Allows for runtime registration of handler functions that override the default warning behavior.
- Warnings are invoked by calls made to [Ember.warn](https://emberjs.com/api/classes/Ember.html#method_warn).
+ Warnings are invoked by calls made to [warn](https://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(() => {});
+ import { registerWarnHandler } from '@ember/debug';
+ // next is not called, so no warnings get the default behavior
+ 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>
@@ -7374,11 +7399,11 @@
<li> <code>next</code> - A function that calls into the previously registered handler.</li>
</ul>
@public
@static
@method registerWarnHandler
- @for Ember.Debug
+ @for @ember/debug
@param handler {Function} A function to handle warnings.
@since 2.1.0
*/
exports.registerHandler = registerHandler = function (handler) {
(0, _handlers.registerHandler)('warn', handler);
@@ -7389,26 +7414,27 @@
if ('trace' in _emberConsole.default) {
_emberConsole.default.trace();
}
});
- exports.missingOptionsDeprecation = missingOptionsDeprecation = 'When calling `Ember.warn` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include an `id` property.';
- exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation = 'When calling `Ember.warn` you must provide `id` in options.';
+ exports.missingOptionsDeprecation = missingOptionsDeprecation = 'When calling `warn` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include an `id` property.';
+ exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation = 'When calling `warn` you must provide `id` in options.';
/**
Display a warning with the provided message.
* In a production build, this method is defined as an empty function (NOP).
Uses of this method in Ember itself are stripped from the ember.prod.js build.
@method warn
+ @for @ember/debug
+ @static
@param {String} message A warning to display.
@param {Boolean} test An optional boolean. If falsy, the warning
will be displayed.
@param {Object} options An object that can be used to pass a unique
`id` for this warning. The `id` can be used by Ember debugging tools
to change the behavior (raise, log, or silence) for that specific warning.
The `id` should be namespaced by dots, e.g. "ember-debug.feature-flag-with-features-stripped"
- @for Ember
@public
@since 1.0.0
*/
warn = function (message, test, options) {
if (arguments.length === 2 && typeof test === 'object') {
@@ -7606,11 +7632,10 @@
Logger = 'default' in Logger ? Logger['default'] : Logger;
Backburner = 'default' in Backburner ? Backburner['default'] : Backburner;
/**
@module ember
- @submodule ember-metal
*/
/**
This namespace contains all Ember methods and functions. Future versions of
Ember may overwrite this namespace and therefore, you should avoid adding any
@@ -7815,12 +7840,11 @@
}
destination.push(target, method, source[index + 3]);
}
/**
- @module ember
- @submodule ember-metal
+ @module @ember/object
*/
/*
The event system uses a series of nested hashes to store listeners on an
object. When a listener is registered, or when an event arrives, these
hashes are consulted to determine which target and action pair to invoke.
@@ -7840,20 +7864,21 @@
/**
Add an event listener
@method addListener
- @for Ember
+ @static
+ @for @ember/object/events
@param obj
@param {String} eventName
@param {Object|Function} target A target object or a function
@param {Function|String} method A function or the name of a function to be called on `target`
@param {Boolean} once A flag whether a function should only be called once
@public
*/
function addListener(obj, eventName, target, method, once) {
- true && !(!!obj && !!eventName) && emberDebug.assert('You must pass at least an object and event name to Ember.addListener', !!obj && !!eventName);
+ true && !(!!obj && !!eventName) && emberDebug.assert('You must pass at least an object and event name to addListener', !!obj && !!eventName);
true && !(eventName !== 'didInitAttrs') && emberDebug.deprecate('didInitAttrs called in ' + (obj && obj.toString && obj.toString()) + '.', eventName !== 'didInitAttrs', {
id: 'ember-views.did-init-attrs',
until: '3.0.0',
url: 'https://emberjs.com/deprecations/v2.x#toc_ember-component-didinitattrs'
});
@@ -7876,22 +7901,23 @@
}
/**
Remove an event listener
- Arguments should match those passed to `Ember.addListener`.
+ Arguments should match those passed to `addListener`.
@method removeListener
- @for Ember
+ @static
+ @for @ember/object/events
@param obj
@param {String} eventName
@param {Object|Function} target A target object or a function
@param {Function|String} method A function or the name of a function to be called on `target`
@public
*/
function removeListener(obj, eventName, target, method) {
- true && !(!!obj && !!eventName) && emberDebug.assert('You must pass at least an object and event name to Ember.removeListener', !!obj && !!eventName);
+ true && !(!!obj && !!eventName) && emberDebug.assert('You must pass at least an object and event name to removeListener', !!obj && !!eventName);
if (!method && 'function' === typeof target) {
method = target;
target = null;
}
@@ -7907,11 +7933,12 @@
when it is taking an action that would cause the event, e.g.
an object might suspend its property change listener while it is
setting that property.
@method suspendListener
- @for Ember
+ @static
+ @for @ember/object/events
@private
@param obj
@param {String} eventName
@param {Object|Function} target A target object or a function
@@ -7924,11 +7951,12 @@
/**
Suspends multiple listeners during a callback.
@method suspendListeners
- @for Ember
+ @static
+ @for @ember/object/events
@private
@param obj
@param {Array} eventNames Array of event names
@param {Object|Function} target A target object or a function
@@ -7946,11 +7974,12 @@
/**
Return a list of currently watched events
@private
@method watchedEvents
- @for Ember
+ @static
+ @for @ember/object/events
@param obj
*/
/**
@@ -7958,11 +7987,12 @@
is skipped, and once listeners are removed. A listener without
a target is executed on the passed object. If an array of actions
is not passed, the actions stored on the passed object are invoked.
@method sendEvent
- @for Ember
+ @static
+ @for @ember/object/events
@param obj
@param {String} eventName
@param {Array} params Optional parameters for each listener.
@param {Array} actions Optional array of actions (listeners).
@param {Meta} meta Optional meta to lookup listeners
@@ -8019,20 +8049,22 @@
}
/**
@private
@method hasListeners
- @for Ember
+ @static
+ @for @ember/object/events
@param obj
@param {String} eventName
*/
/**
@private
@method listenersFor
- @for Ember
+ @static
+ @for @ember/object/events
@param obj
@param {String} eventName
*/
function listenersFor(obj, eventName) {
var ret = [],
@@ -8060,23 +8092,28 @@
Define a property as a function that should be executed when
a specified event or events are triggered.
``` javascript
- let Job = Ember.Object.extend({
- logCompleted: Ember.on('completed', function() {
+ import EmberObject from '@ember/object';
+ import { on } from '@ember/object/evented';
+ import { sendEvent } from '@ember/object/events';
+
+ let Job = EmberObject.extend({
+ logCompleted: on('completed', function() {
console.log('Job completed!');
})
});
let job = Job.create();
- Ember.sendEvent(job, 'completed'); // Logs 'Job completed!'
+ sendEvent(job, 'completed'); // Logs 'Job completed!'
```
@method on
- @for Ember
+ @static
+ @for @ember/object/evented
@param {String} eventNames*
@param {Function} func
@return func
@public
*/
@@ -8309,10 +8346,15 @@
context$$1[methodName]();
return false;
};
}
+ /**
+ @module ember
+ @private
+ */
+
var PROPERTY_DID_CHANGE = emberUtils.symbol('PROPERTY_DID_CHANGE');
var beforeObserverSet = new ObserverSet();
var observerSet = new ObserverSet();
var deferred = 0;
@@ -8624,11 +8666,11 @@
sendEvent(obj, eventName, [obj, keyName]);
}
}
/**
- @module ember-metal
+ @module @ember/object
*/
// ..........................................................
// DESCRIPTOR
//
@@ -8668,11 +8710,11 @@
function SETTER_FUNCTION(value) {
var m = exports.peekMeta(this);
if (!m.isInitialized(this)) {
m.writeValues(name, value);
} else {
- true && !false && emberDebug.assert('You must use Ember.set() to set the `' + name + '` property (of ' + this + ') to `' + value + '`.', false);
+ true && !false && emberDebug.assert('You must use set() to set the `' + name + '` property (of ' + this + ') to `' + value + '`.', false);
}
}
SETTER_FUNCTION.isMandatorySetter = true;
return SETTER_FUNCTION;
@@ -8710,11 +8752,11 @@
}
/**
NOTE: This is a low-level method used by other parts of the API. You almost
never want to call this method directly. Instead you should use
- `Ember.mixin()` to define new properties.
+ `mixin()` to define new properties.
Defines a property on an object. This method works much like the ES5
`Object.defineProperty()` method except that it can also accept computed
properties and other special descriptors.
@@ -8724,30 +8766,32 @@
creating new descriptor hashes for each property.
## Examples
```javascript
+ import { defineProperty, computed } from '@ember/object';
+
// ES5 compatible mode
- Ember.defineProperty(contact, 'firstName', {
+ defineProperty(contact, 'firstName', {
writable: true,
configurable: false,
enumerable: true,
value: 'Charles'
});
// define a simple property
- Ember.defineProperty(contact, 'lastName', undefined, 'Jolley');
+ defineProperty(contact, 'lastName', undefined, 'Jolley');
// define a computed property
- Ember.defineProperty(contact, 'fullName', Ember.computed('firstName', 'lastName', function() {
+ defineProperty(contact, 'fullName', computed('firstName', 'lastName', function() {
return this.firstName+' '+this.lastName;
}));
```
@private
@method defineProperty
- @for Ember
+ @for @ember/object
@param {Object} obj the object to define this property on. This may be a prototype.
@param {String} keyName the name of the property
@param {Descriptor} [desc] an instance of `Descriptor` (typically a
computed property) or an ES5 descriptor.
You must provide this or `data` but not both.
@@ -9431,11 +9475,11 @@
metaInstantiated: 0
};
}
/**
- @module ember-metal
+ @module ember
*/
var UNDEFINED = emberUtils.symbol('undefined');
// FLAGS
@@ -10160,11 +10204,11 @@
function getTailPath(path) {
return tailPathCache.get(path);
}
/**
- @module ember-metal
+ @module @ember/object
*/
var ALLOWABLE_TYPES = {
object: true,
function: true,
@@ -10199,11 +10243,12 @@
Note that if the object itself is `undefined`, this method will throw
an error.
@method get
- @for Ember
+ @for @ember/object
+ @static
@param {Object} obj The object to retrieve from.
@param {String} keyName The property key to retrieve
@return {Object} the property value or `null`.
@public
*/
@@ -10259,31 +10304,36 @@
```javascript
Ember.getWithDefault(person, 'lastName', 'Doe');
```
@method getWithDefault
- @for Ember
+ @for @ember/object
+ @static
@param {Object} obj The object to retrieve from.
@param {String} keyName The name of the property to retrieve
@param {Object} defaultValue The value to return if the property value is undefined
@return {Object} The property value or the defaultValue.
@public
*/
/**
+ @module @ember/object
+ */
+ /**
Sets the value of a property on an object, respecting computed properties
and notifying observers and other listeners of the change. If the
property is not defined but the object implements the `setUnknownProperty`
method then that will be invoked as well.
```javascript
Ember.set(obj, "name", value);
```
@method set
- @for Ember
+ @static
+ @for @ember/object
@param {Object} obj The object to modify.
@param {String} keyName The property key to set
@param {Object} value The value to set
@return {Object} the passed value.
@public
@@ -10368,23 +10418,23 @@
This is primarily used when syncing bindings, which may try to update after
an object has been destroyed.
@method trySet
- @for Ember
+ @static
+ @for @ember/object
@param {Object} root The object to modify.
@param {String} path The property path to set
@param {Object} value The value to set
@public
*/
function trySet(root, path, value) {
return set(root, path, value, true);
}
/**
- @module ember
- @submodule ember-metal
+ @module @ember/object
*/
var END_WITH_EACH_REGEX = /\.@each$/;
/**
@@ -10394,23 +10444,26 @@
once to `callback` directly.
Example
```js
+ import { expandProperties } from '@ember/object/computed';
+
function echo(arg){ console.log(arg); }
- Ember.expandProperties('foo.bar', echo); //=> 'foo.bar'
- Ember.expandProperties('{foo,bar}', echo); //=> 'foo', 'bar'
- Ember.expandProperties('foo.{bar,baz}', echo); //=> 'foo.bar', 'foo.baz'
- Ember.expandProperties('{foo,bar}.baz', echo); //=> 'foo.baz', 'bar.baz'
- Ember.expandProperties('foo.{bar,baz}.[]', echo) //=> 'foo.bar.[]', 'foo.baz.[]'
- Ember.expandProperties('{foo,bar}.{spam,eggs}', echo) //=> 'foo.spam', 'foo.eggs', 'bar.spam', 'bar.eggs'
- Ember.expandProperties('{foo}.bar.{baz}') //=> 'foo.bar.baz'
+ expandProperties('foo.bar', echo); //=> 'foo.bar'
+ expandProperties('{foo,bar}', echo); //=> 'foo', 'bar'
+ expandProperties('foo.{bar,baz}', echo); //=> 'foo.bar', 'foo.baz'
+ expandProperties('{foo,bar}.baz', echo); //=> 'foo.baz', 'bar.baz'
+ expandProperties('foo.{bar,baz}.[]', echo) //=> 'foo.bar.[]', 'foo.baz.[]'
+ expandProperties('{foo,bar}.{spam,eggs}', echo) //=> 'foo.spam', 'foo.eggs', 'bar.spam', 'bar.eggs'
+ expandProperties('{foo}.bar.{baz}') //=> 'foo.bar.baz'
```
@method expandProperties
- @for Ember
+ @static
+ @for @ember/object
@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.
*/
@@ -10448,11 +10501,11 @@
}
}
}
/**
- @module ember-metal
+ @module ember
*/
/**
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
@@ -10484,15 +10537,10 @@
} else {
unwatchKey(obj, _keyPath, m);
}
}
- /**
- @module ember
- @submodule ember-metal
- */
-
// ..........................................................
// DEPENDENT KEYS
//
function addDependentKeys(desc, obj, keyName, meta) {
@@ -10534,12 +10582,11 @@
unwatch(obj, depKey, meta);
}
}
/**
- @module ember
- @submodule ember-metal
+ @module @ember/object
*/
var DEEP_EACH_REGEX = /\.@each\.[^.]+\./;
/**
@@ -10549,27 +10596,29 @@
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 - `fullName` - by calling
- `.Ember.computed()` with property dependencies (`firstName` and `lastName`) as leading arguments and getter accessor function. The `fullName` getter function
+ `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
values.
```javascript
- let Person = Ember.Object.extend({
+ import EmberObject, { computed } from '@ember/object';
+
+ let Person = EmberObject.extend({
// these will be supplied by `create`
firstName: null,
lastName: null,
- fullName: Ember.computed('firstName', 'lastName', function() {
+ fullName: computed('firstName', 'lastName', function() {
let firstName = this.get('firstName'),
lastName = this.get('lastName');
- return firstName + ' ' + lastName;
+ return `${firstName} ${lastName}`;
})
});
let tom = Person.create({
firstName: 'Tom',
@@ -10582,16 +10631,18 @@
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
- let Person = Ember.Object.extend({
+ import EmberObject, { computed } from '@ember/object';
+
+ let Person = EmberObject.extend({
// these will be supplied by `create`
firstName: null,
lastName: null,
- fullName: Ember.computed('firstName', 'lastName', {
+ fullName: computed('firstName', 'lastName', {
get(key) {
let firstName = this.get('firstName'),
lastName = this.get('lastName');
return firstName + ' ' + lastName;
@@ -10617,16 +10668,18 @@
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({
+ import EmberObject, { computed } from '@ember/object';
+
+ let Person = EmberObject.extend({
// these will be supplied by `create`
firstName: null,
lastName: null,
- fullName: Ember.computed('firstName', 'lastName', {
+ fullName: computed('firstName', 'lastName', {
get(key) {
let firstName = this.get('firstName');
let lastName = this.get('lastName');
return firstName + ' ' + lastName;
@@ -10641,23 +10694,22 @@
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" ](https://emberjs.com/blog/2015/05/13/ember-1-12-released.html#toc_new-computed-syntax)
@class ComputedProperty
- @namespace Ember
@public
*/
function ComputedProperty(config, opts) {
this.isDescriptor = true;
var hasGetterOnly = typeof config === 'function';
if (hasGetterOnly) {
this._getter = config;
} else {
- true && !(typeof config === 'object' && !Array.isArray(config)) && emberDebug.assert('Ember.computed expects a function or an object as last argument.', typeof config === 'object' && !Array.isArray(config));
+ true && !(typeof config === 'object' && !Array.isArray(config)) && emberDebug.assert('computed expects a function or an object as last argument.', typeof config === 'object' && !Array.isArray(config));
true && !Object.keys(config).every(function (key) {
return key === 'get' || key === 'set';
- }) && emberDebug.assert('Config object passed to an Ember.computed can only contain `get` or `set` keys.', Object.keys(config).every(function (key) {
+ }) && emberDebug.assert('Config object passed to computed can only contain `get` or `set` keys.', Object.keys(config).every(function (key) {
return key === 'get' || key === 'set';
}));
this._getter = config.get;
this._setter = config.set;
@@ -10686,19 +10738,23 @@
Dependency keys have no effect on volatile properties as they are for cache
invalidation and notification when cached value is invalidated.
```javascript
- let outsideService = Ember.Object.extend({
- value: Ember.computed(function() {
+ import EmberObject, { computed } from '@ember/object';
+
+ let outsideService = EmberObject.extend({
+ value: computed(function() {
return OutsideService.getValue();
}).volatile()
}).create();
```
@method volatile
- @return {Ember.ComputedProperty} this
+ @static
+ @for @ember/object/computed
+ @return {ComputedProperty} this
@chainable
@public
*/
ComputedPropertyPrototype.volatile = function () {
this._volatile = true;
@@ -10708,23 +10764,27 @@
/**
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
- let Person = Ember.Object.extend({
- guid: Ember.computed(function() {
+ import EmberObject, { computed } from '@ember/object';
+
+ let Person = EmberObject.extend({
+ guid: computed(function() {
return 'guid-guid-guid';
}).readOnly()
});
let person = Person.create();
person.set('guid', 'new-guid'); // will throw an exception
```
@method readOnly
- @return {Ember.ComputedProperty} this
+ @static
+ @for @ember/object/computed
+ @return {ComputedProperty} this
@chainable
@public
*/
ComputedPropertyPrototype.readOnly = function () {
this._readOnly = true;
@@ -10736,17 +10796,19 @@
/**
Sets the dependent keys on this computed property. Pass any number of
arguments containing key paths that this computed property depends on.
```javascript
- let President = Ember.Object.extend({
- fullName: Ember.computed(function() {
+ import EmberObject, { computed } from '@ember/object';
+
+ let President = EmberObject.extend({
+ fullName: computed('firstName', 'lastName', function() {
return this.get('firstName') + ' ' + this.get('lastName');
// Tell Ember that this computed property depends on firstName
// and lastName
- }).property('firstName', 'lastName')
+ })
});
let president = President.create({
firstName: 'Barack',
lastName: 'Obama'
@@ -10754,12 +10816,14 @@
president.get('fullName'); // 'Barack Obama'
```
@method property
+ @static
+ @for @ember/object/computed
@param {String} path* zero or more property paths
- @return {Ember.ComputedProperty} this
+ @return {ComputedProperty} this
@chainable
@public
*/
ComputedPropertyPrototype.property = function () {
var args = [],
@@ -10801,10 +10865,12 @@
computed property descriptor under the `_meta` key. Ember runtime
exposes a public API for retrieving these values from classes,
via the `metaForProperty()` function.
@method meta
+ @static
+ @for @ember/object/computed
@param {Object} meta
@chainable
@public
*/
ComputedPropertyPrototype.meta = function (meta$$1) {
@@ -10957,25 +11023,27 @@
};
/**
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()`.
+ with mixins or via `defineProperty()`.
If you pass a function as an argument, it will be used as a getter. A computed
property defined in this way might look like this:
```js
- let Person = Ember.Object.extend({
+ import EmberObject, { computed } from '@ember/object';
+
+ let Person = EmberObject.extend({
init() {
this._super(...arguments);
this.firstName = 'Betty';
this.lastName = 'Jones';
},
- fullName: Ember.computed('firstName', 'lastName', function() {
+ fullName: computed('firstName', 'lastName', function() {
return `${this.get('firstName')} ${this.get('lastName')}`;
})
});
let client = Person.create();
@@ -10988,19 +11056,21 @@
You can pass a hash with two functions, `get` and `set`, as an
argument to provide both a getter and setter:
```js
- let Person = Ember.Object.extend({
+ import EmberObject, { computed } from '@ember/object';
+
+ let Person = EmberObject.extend({
init() {
this._super(...arguments);
this.firstName = 'Betty';
this.lastName = 'Jones';
},
- fullName: Ember.computed('firstName', 'lastName', {
+ fullName: computed('firstName', 'lastName', {
get(key) {
return `${this.get('firstName')} ${this.get('lastName')}`;
},
set(key, value) {
let [firstName, lastName] = value.split(/\s+/);
@@ -11030,17 +11100,16 @@
fullName: function() {
return this.get('firstName') + ' ' + this.get('lastName');
}.property('firstName', 'lastName')
```
- @class computed
- @namespace Ember
- @constructor
+ @method computed
+ @for @ember/object
@static
@param {String} [dependentKeys*] Optional dependent keys that trigger this computed property.
@param {Function} func The computed property function.
- @return {Ember.ComputedProperty} property descriptor instance
+ @return {ComputedProperty} property descriptor instance
@public
*/
/**
@@ -11048,11 +11117,12 @@
This can be useful for peeking at the value of a computed
property that is generated lazily, without accidentally causing
it to be created.
@method cacheFor
- @for Ember
+ @static
+ @for @ember/object/internals
@param {Object} obj the object whose property you want to check
@param {String} key the name of the property whose cached value you want
to return
@return {Object} the cached value
@public
@@ -11166,31 +11236,36 @@
// Backwards compatibility with Ember Data.
AliasedProperty.prototype._meta = undefined;
AliasedProperty.prototype.meta = ComputedProperty.prototype.meta;
/**
+ @module @ember/polyfills
+ */
+ /**
Merge the contents of two objects together into the first object.
```javascript
- Ember.merge({ first: 'Tom' }, { last: 'Dale' }); // { first: 'Tom', last: 'Dale' }
+ import { merge } from '@ember/polyfills';
+
+ merge({ first: 'Tom' }, { last: 'Dale' }); // { first: 'Tom', last: 'Dale' }
var a = { first: 'Yehuda' };
var b = { last: 'Katz' };
- Ember.merge(a, b); // a == { first: 'Yehuda', last: 'Katz' }, b == { last: 'Katz' }
+ merge(a, b); // a == { first: 'Yehuda', last: 'Katz' }, b == { last: 'Katz' }
```
@method merge
- @for Ember
+ @static
+ @for @ember/polyfills
@param {Object} original The object to merge into
@param {Object} updates The object to copy properties from
@return {Object}
@public
*/
/**
@module ember
- @submodule ember-metal
*/
/**
Used internally to allow changing properties in a backwards compatible way, and print a helpful
deprecation warning.
@@ -11205,18 +11280,25 @@
/* eslint no-console:off */
/* global console */
/**
+ @module @ember/instrumentation
+ @private
+ */
+
+ /**
The purpose of the Ember Instrumentation module is
to provide efficient, general-purpose instrumentation
for Ember.
- Subscribe to a listener by using `Ember.subscribe`:
+ Subscribe to a listener by using `subscribe`:
```javascript
- Ember.subscribe("render", {
+ import { subscribe } from '@ember/instrumentation';
+
+ subscribe("render", {
before(name, timestamp, payload) {
},
after(name, timestamp, payload) {
@@ -11227,19 +11309,21 @@
If you return a value from the `before` callback, that same
value will be passed as a fourth parameter to the `after`
callback.
- Instrument a block of code by using `Ember.instrument`:
+ Instrument a block of code by using `instrument`:
```javascript
- Ember.instrument("render.handlebars", payload, function() {
+ import { instrument } from '@ember/instrumentation';
+
+ instrument("render.handlebars", payload, function() {
// rendering logic
}, binding);
```
- Event names passed to `Ember.instrument` are namespaced
+ Event names passed to `instrument` are namespaced
by periods, from more general to more specific. Subscribers
can listen for events by whatever level of granularity they
are interested in.
In the above example, the event is `render.handlebars`,
@@ -11247,11 +11331,10 @@
`render`. It would receive callbacks for events named
`render`, `render.handlebars`, `render.container`, or
even `render.handlebars.layout`.
@class Instrumentation
- @namespace Ember
@static
@private
*/
var subscribers = [];
var cache = {};
@@ -11283,12 +11366,12 @@
/**
Notifies event's subscribers, calls `before` and `after` hooks.
@method instrument
- @namespace Ember.Instrumentation
-
+ @for @ember/instrumentation
+ @static
@param {String} [name] Namespaced event name.
@param {Object} _payload
@param {Function} callback Function that you're instrumenting.
@param {Object} binding Context that instrument function is called with.
@private
@@ -11390,11 +11473,12 @@
/**
Subscribes to a particular event or instrumented block of code.
@method subscribe
- @namespace Ember.Instrumentation
+ @for @ember/instrumentation
+ @static
@param {String} [pattern] Namespaced event name.
@param {Object} [object] Before and After hooks.
@return {Subscriber}
@@ -11404,22 +11488,24 @@
/**
Unsubscribes from a particular event or instrumented block of code.
@method unsubscribe
- @namespace Ember.Instrumentation
+ @for @ember/instrumentation
+ @static
@param {Object} [subscriber]
@private
*/
/**
- Resets `Ember.Instrumentation` by flushing list of subscribers.
+ Resets `Instrumentation` by flushing list of subscribers.
@method reset
- @namespace Ember.Instrumentation
+ @for @ember/instrumentation
+ @static
@private
*/
// To maintain stacktrace consistency across browsers
@@ -11462,10 +11548,13 @@
} else {
Logger.error(getStack(error));
}
}
+ /**
+ @module ember
+ */
var id = 0;
// Returns whether Type(value) is Object according to the terminology in the spec
function isObject$1(value) {
return typeof value === 'object' && value !== null || typeof value === 'function';
@@ -11603,55 +11692,63 @@
}();
var weak_map = emberUtils.HAS_NATIVE_WEAKMAP ? WeakMap : WeakMapPolyfill;
/**
+ @module @ember/utils
+ */
+ /**
Returns true if the passed value is null or undefined. This avoids errors
from JSLint complaining about use of ==, which can be technically
confusing.
```javascript
- Ember.isNone(); // true
- Ember.isNone(null); // true
- Ember.isNone(undefined); // true
- Ember.isNone(''); // false
- Ember.isNone([]); // false
- Ember.isNone(function() {}); // false
+ isNone(); // true
+ isNone(null); // true
+ isNone(undefined); // true
+ isNone(''); // false
+ isNone([]); // false
+ isNone(function() {}); // false
```
@method isNone
- @for Ember
+ @static
+ @for @ember/utils
@param {Object} obj Value to test
@return {Boolean}
@public
*/
function isNone(obj) {
return obj === null || obj === undefined;
}
/**
+ @module @ember/utils
+ */
+ /**
Verifies that a value is `null` or `undefined`, an empty string, or an empty
array.
- Constrains the rules on `Ember.isNone` by returning true for empty strings and
+ Constrains the rules on `isNone` by returning true for empty strings and
empty arrays.
```javascript
- Ember.isEmpty(); // true
- Ember.isEmpty(null); // true
- Ember.isEmpty(undefined); // true
- Ember.isEmpty(''); // true
- Ember.isEmpty([]); // true
- Ember.isEmpty({}); // false
- Ember.isEmpty('Adam Hawkins'); // false
- Ember.isEmpty([0,1,2]); // false
- Ember.isEmpty('\n\t'); // false
- Ember.isEmpty(' '); // false
+ isEmpty(); // true
+ isEmpty(null); // true
+ isEmpty(undefined); // true
+ isEmpty(''); // true
+ isEmpty([]); // true
+ isEmpty({}); // false
+ isEmpty('Adam Hawkins'); // false
+ isEmpty([0,1,2]); // false
+ isEmpty('\n\t'); // false
+ isEmpty(' '); // false
```
@method isEmpty
- @for Ember
+ @static
+ @for @ember/utils
@param {Object} obj Value to test
@return {Boolean}
@public
*/
function isEmpty(obj) {
@@ -11690,62 +11787,72 @@
return false;
}
/**
+ @module @ember/utils
+ */
+ /**
A value is blank if it is empty or a whitespace string.
```javascript
- Ember.isBlank(); // true
- Ember.isBlank(null); // true
- Ember.isBlank(undefined); // true
- Ember.isBlank(''); // true
- Ember.isBlank([]); // true
- Ember.isBlank('\n\t'); // true
- Ember.isBlank(' '); // true
- Ember.isBlank({}); // false
- Ember.isBlank('\n\t Hello'); // false
- Ember.isBlank('Hello world'); // false
- Ember.isBlank([1,2,3]); // false
+ import { isBlank } from '@ember/utils';
+
+ isBlank(); // true
+ isBlank(null); // true
+ isBlank(undefined); // true
+ isBlank(''); // true
+ isBlank([]); // true
+ isBlank('\n\t'); // true
+ isBlank(' '); // true
+ isBlank({}); // false
+ isBlank('\n\t Hello'); // false
+ isBlank('Hello world'); // false
+ isBlank([1,2,3]); // false
```
@method isBlank
- @for Ember
+ @static
+ @for @ember/utils
@param {Object} obj Value to test
@return {Boolean}
@since 1.5.0
@public
*/
function isBlank(obj) {
return isEmpty(obj) || typeof obj === 'string' && /\S/.test(obj) === false;
}
/**
+ @module @ember/utils
+ */
+ /**
A value is present if it not `isBlank`.
```javascript
- Ember.isPresent(); // false
- Ember.isPresent(null); // false
- Ember.isPresent(undefined); // false
- Ember.isPresent(''); // false
- Ember.isPresent(' '); // false
- Ember.isPresent('\n\t'); // false
- Ember.isPresent([]); // false
- Ember.isPresent({ length: 0 }) // false
- Ember.isPresent(false); // true
- Ember.isPresent(true); // true
- Ember.isPresent('string'); // true
- Ember.isPresent(0); // true
- Ember.isPresent(function() {}) // true
- Ember.isPresent({}); // true
- Ember.isPresent(false); // true
- Ember.isPresent('\n\t Hello'); // true
- Ember.isPresent([1,2,3]); // true
+ isPresent(); // false
+ isPresent(null); // false
+ isPresent(undefined); // false
+ isPresent(''); // false
+ isPresent(' '); // false
+ isPresent('\n\t'); // false
+ isPresent([]); // false
+ isPresent({ length: 0 }) // false
+ isPresent(false); // true
+ isPresent(true); // true
+ isPresent('string'); // true
+ isPresent(0); // true
+ isPresent(function() {}) // true
+ isPresent({}); // true
+ isPresent(false); // true
+ isPresent('\n\t Hello'); // true
+ isPresent([1,2,3]); // true
```
@method isPresent
- @for Ember
+ @static
+ @for @ember/utils
@param {Object} obj Value to test
@return {Boolean}
@since 1.8.0
@public
*/
@@ -11766,10 +11873,13 @@
},
onErrorTarget: onErrorTarget,
onErrorMethod: 'onerror'
});
+ /**
+ @module @ember/runloop
+ */
// ..........................................................
// run - this is ideally the only public API the dev sees
//
/**
@@ -11786,12 +11896,11 @@
run(function() {
// code to be executed within a RunLoop
});
```
- @class run
- @namespace Ember
+ @class @ember/runloop
@static
@constructor
@param {Object} [target] target of method to call
@param {Function|String} method Method to invoke.
May be a function or a string. If you pass a string
@@ -11830,11 +11939,12 @@
});
});
```
@method join
- @namespace Ember
+ @static
+ @for @ember/runloop
@param {Object} [target] target of method to call
@param {Function|String} method Method to invoke.
May be a function or a string. If you pass a string
then it will be looked up on the passed target.
@param {Object} [args*] Any additional arguments you wish to pass to the method.
@@ -11894,11 +12004,12 @@
In this example, we use Ember.run.bind to bind the setupEditor method to the
context of the RichTextEditor component and to have the invocation of that
method be safely handled and executed by the Ember run loop.
@method bind
- @namespace Ember
+ @static
+ @for @ember/runloop
@param {Object} [target] target of method to call
@param {Function|String} method Method to invoke.
May be a function or a string. If you pass a string
then it will be looked up on the passed target.
@param {Object} [args*] Any additional arguments you wish to pass to the method.
@@ -11938,10 +12049,12 @@
// code to be executed within a RunLoop
run.end();
```
@method begin
+ @static
+ @for @ember/runloop
@return {void}
@public
*/
run.begin = function () {
backburner$1.begin();
@@ -11957,10 +12070,12 @@
// code to be executed within a RunLoop
run.end();
```
@method end
+ @static
+ @for @ember/runloop
@return {void}
@public
*/
run.end = function () {
backburner$1.end();
@@ -12004,10 +12119,12 @@
// scheduled on sync queue
// scheduled on actions queue
```
@method schedule
+ @static
+ @for @ember/runloop
@param {String} queue The name of the queue to schedule against.
Default queues are 'sync' and 'actions'
@param {Object} [target] target object to use as the context when invoking a method.
@param {String|Function} method The method to invoke. If you pass a string it
will be resolved on the target object at the time the scheduled item is
@@ -12044,10 +12161,12 @@
```javascript
run.sync();
```
@method sync
+ @static
+ @for @ember/runloop
@return {void}
@private
*/
run.sync = function () {
if (backburner$1.currentInstance) {
@@ -12070,10 +12189,12 @@
// code here will execute within a RunLoop in about 500ms with this == myContext
}, 500);
```
@method later
+ @static
+ @for @ember/runloop
@param {Object} [target] target of method to invoke
@param {Function|String} method The method to invoke.
If you pass a string it will be resolved on the
target at the time the method is invoked.
@param {Object} [args*] Optional arguments to pass to the timeout.
@@ -12088,10 +12209,12 @@
/**
Schedule a function to run one time during the current RunLoop. This is equivalent
to calling `scheduleOnce` with the "actions" queue.
@method once
+ @static
+ @for @ember/runloop
@param {Object} [target] The target of the method to invoke.
@param {Function|String} method The method to invoke.
If you pass a string it will be resolved on the
target at the time the method is invoked.
@param {Object} [args*] Optional arguments to pass to the timeout.
@@ -12166,10 +12289,12 @@
```
Available queues, and their order, can be found at `run.queues`
@method scheduleOnce
+ @static
+ @for @ember/runloop
@param {String} [queue] The name of the queue to schedule against. Default queues are 'sync' and 'actions'.
@param {Object} [target] The target of the method to invoke.
@param {Function|String} method The method to invoke.
If you pass a string it will be resolved on the
target at the time the method is invoked.
@@ -12238,10 +12363,12 @@
harder to test, due to its reliance on `setTimeout`; it's much harder
to guarantee the order of scheduled operations when they are scheduled
outside of the current run loop, i.e. with `run.next`.
@method next
+ @static
+ @for @ember/runloop
@param {Object} [target] target of method to invoke
@param {Function|String} method The method to invoke.
If you pass a string it will be resolved on the
target at the time the method is invoked.
@param {Object} [args*] Optional arguments to pass to the timeout.
@@ -12308,10 +12435,12 @@
// the 100ms delay until this method can be called again will be canceled
run.cancel(debounceImmediate);
```
@method cancel
+ @static
+ @for @ember/runloop
@param {Object} timer Timer object to cancel
@return {Boolean} true if canceled or false/undefined if it wasn't found
@public
*/
run.cancel = function (timer) {
@@ -12374,10 +12503,12 @@
// the debouncee is no longer being watched
```
@method debounce
+ @static
+ @for @ember/runloop
@param {Object} [target] target of method to invoke
@param {Function|String} method The method to invoke.
May be a function or a string. If you pass a string
then it will be looked up on the passed target.
@param {Object} [args*] Optional arguments to pass to the timeout.
@@ -12417,10 +12548,12 @@
// whoRan is invoked with context myContext
// console logs 'throttle ran.'
```
@method throttle
+ @static
+ @for @ember/runloop
@param {Object} [target] target of method to invoke
@param {Function|String} method The method to invoke.
May be a function or a string. If you pass a string
then it will be looked up on the passed target.
@param {Object} [args*] Optional arguments to pass to the timeout.
@@ -12449,10 +12582,13 @@
run.queues.splice(run.queues.indexOf(after) + 1, 0, name);
}
};
/**
+ @module ember
+ */
+ /**
Helper class that allows you to register your library with Ember.
Singleton created at `Ember.libraries`.
@class Libraries
@@ -12521,29 +12657,28 @@
var libraries = new Libraries();
/**
@module ember
- @submodule ember-metal
*/
/*
JavaScript (before ES6) does not have a Map implementation. Objects,
which are often used as dictionaries, may only have Strings as keys.
Because Ember has a way to get a unique identifier for every object
- via `Ember.guidFor`, we can implement a performant Map with arbitrary
+ via `guidFor`, we can implement a performant Map with arbitrary
keys. Because it is commonly used in low-level bookkeeping, Map is
implemented as a pure JavaScript object for performance.
This implementation follows the current iteration of the ES6 proposal for
maps (http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets),
with one exception: as we do not have the luxury of in-VM iteration, we implement a
forEach method for iteration.
Map is mocked out to look like an Ember object, so you can do
- `Ember.Map.create()` for symmetry with other Ember classes.
+ `EmberMap.create()` for symmetry with other Ember classes.
*/
function missingFunction(fn) {
throw new TypeError(Object.prototype.toString.call(fn) + ' is not a function');
}
@@ -12751,11 +12886,11 @@
object.
Internally, a Map has two data structures:
1. `keys`: an OrderedSet of all of the existing keys
- 2. `values`: a JavaScript Object indexed by the `Ember.guidFor(key)`
+ 2. `values`: a JavaScript Object indexed by the `guidFor(key)`
When a key/value pair is added for the first time, we
add the key to the `keys` OrderedSet, and create or
replace an entry in `values`. When an entry is deleted,
we delete its entry in `keys` and `values`.
@@ -12956,11 +13091,11 @@
@method create
@static
@param [options]
@param {*} [options.defaultValue]
@return {Ember.MapWithDefault|Ember.Map} If options are passed, returns
- `Ember.MapWithDefault` otherwise returns `Ember.Map`
+ `MapWithDefault` otherwise returns `EmberMap`
@private
*/
MapWithDefault.create = function (options) {
if (options) {
return new MapWithDefault(options);
@@ -13007,35 +13142,47 @@
defaultValue: this.defaultValue
}));
};
/**
- To get multiple properties at once, call `Ember.getProperties`
+ @module @ember/object
+ */
+
+ /**
+ To get multiple properties at once, call `getProperties`
with an object followed by a list of strings or an array:
```javascript
- Ember.getProperties(record, 'firstName', 'lastName', 'zipCode');
+ import { getProperties } from '@ember/object';
+
+ getProperties(record, 'firstName', 'lastName', 'zipCode');
// { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
```
is equivalent to:
```javascript
- Ember.getProperties(record, ['firstName', 'lastName', 'zipCode']);
+ import { getProperties } from '@ember/object';
+
+ getProperties(record, ['firstName', 'lastName', 'zipCode']);
// { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
```
@method getProperties
- @for Ember
+ @static
+ @for @ember/object
@param {Object} obj
@param {String...|Array} list of keys to get
@return {Object}
@public
*/
/**
+ @module @ember/object
+ */
+ /**
Set a list of properties on an object. These properties are set inside
a single `beginPropertyChanges` and `endPropertyChanges` batch, so
observers will be buffered.
```javascript
@@ -13047,19 +13194,21 @@
age: 21
});
```
@method setProperties
+ @static
+ @for @ember/object
@param obj
@param {Object} properties
@return properties
@public
*/
/**
- @module ember-metal
+ @module @ember/object
*/
function changeEvent(keyName) {
return keyName + ':change';
}
@@ -13068,11 +13217,12 @@
return keyName + ':before';
}
/**
@method addObserver
- @for Ember
+ @static
+ @for @ember/object/observers
@param obj
@param {String} _path
@param {Object|Function} target
@param {Function|String} [method]
@public
@@ -13084,11 +13234,12 @@
return this;
}
/**
@method removeObserver
- @for Ember
+ @static
+ @for @ember/object/observers
@param obj
@param {String} path
@param {Object|Function} target
@param {Function|String} [method]
@public
@@ -13100,11 +13251,12 @@
return this;
}
/**
@method _addBeforeObserver
- @for Ember
+ @static
+ @for @ember/object/observers
@param obj
@param {String} path
@param {Object|Function} target
@param {Function|String} [method]
@deprecated
@@ -13125,11 +13277,12 @@
return suspendListener(obj, changeEvent(path), target, method, callback);
}
/**
@method removeBeforeObserver
- @for Ember
+ @static
+ @for @ember/object/observers
@param obj
@param {String} path
@param {Object|Function} target
@param {Function|String} [method]
@deprecated
@@ -13142,11 +13295,10 @@
return this;
}
/**
@module ember
- @submodule ember-metal
*/
// ..........................................................
// BINDING
//
@@ -13621,12 +13773,11 @@
@public
*/
/**
- @module ember
- @submodule ember-metal
+ @module @ember/object
*/
var a_concat = Array.prototype.concat;
var isArray = Array.isArray;
function isMethod(obj) {
@@ -14012,76 +14163,97 @@
return obj;
}
/**
@method mixin
- @for Ember
@param obj
@param mixins*
@return obj
@private
*/
/**
- The `Ember.Mixin` class allows you to create mixins, whose properties can be
+ The `Mixin` class allows you to create mixins, whose properties can be
added to other classes. For instance,
```javascript
- const EditableMixin = Ember.Mixin.create({
+ import Mixin from '@ember/object/mixin';
+
+ const EditableMixin = Mixin.create({
edit() {
console.log('starting to edit');
this.set('isEditing', true);
},
isEditing: false
});
+ ```
+ ```javascript
+ import EmberObject from '@ember/object';
+ import EditableMixin from '../mixins/editable';
+
// Mix mixins into classes by passing them as the first arguments to
// `.extend.`
- const Comment = Ember.Object.extend(EditableMixin, {
+ const Comment = EmberObject.extend(EditableMixin, {
post: null
});
let comment = Comment.create({
post: somePost
});
comment.edit(); // outputs 'starting to edit'
```
- Note that Mixins are created with `Ember.Mixin.create`, not
- `Ember.Mixin.extend`.
+ Note that Mixins are created with `Mixin.create`, not
+ `Mixin.extend`.
Note that mixins extend a constructor's prototype so arrays and object literals
defined as properties will be shared amongst objects that implement the mixin.
If you want to define a property in a mixin that is not shared, you can define
it either as a computed property or have it be created on initialization of the object.
```javascript
// filters array will be shared amongst any object implementing mixin
- const FilterableMixin = Ember.Mixin.create({
- filters: Ember.A()
+ import Mixin from '@ember/object/mixin';
+ import { A } from '@ember/array';
+
+ const FilterableMixin = Mixin.create({
+ filters: A()
});
+ ```
+ ```javascript
+ import Mixin from '@ember/object/mixin';
+ import { A } from '@ember/array';
+ import { computed } from '@ember/object';
+
// filters will be a separate array for every object implementing the mixin
- const FilterableMixin = Ember.Mixin.create({
- filters: Ember.computed(function() {
- return Ember.A();
+ const FilterableMixin = Mixin.create({
+ filters: computed(function() {
+ return A();
})
});
+ ```
+ ```javascript
+ import Mixin from '@ember/object/mixin';
+ import { A } from '@ember/array';
+
// filters will be created as a separate array during the object's initialization
- const Filterable = Ember.Mixin.create({
+ const Filterable = Mixin.create({
+ filters: null,
+
init() {
this._super(...arguments);
- this.set("filters", Ember.A());
+ this.set("filters", A());
}
});
```
@class Mixin
- @namespace Ember
@public
*/
var Mixin = function () {
function Mixin(mixins, properties) {
@@ -14128,10 +14300,11 @@
return applyMixin(obj, args, true);
};
/**
@method create
+ @for @ember/object/mixin
@static
@param arguments*
@public
*/
@@ -14149,11 +14322,11 @@
return new M(args, undefined);
};
// returns the mixins currently applied to the specified object
- // TODO: Make Ember.mixin
+ // TODO: Make `mixin`
Mixin.mixins = function (obj) {
var meta$$1 = exports.peekMeta(obj);
var ret = [];
@@ -14363,11 +14536,12 @@
goodGuy.name(); // 'Tomhuda Katzdale'
goodGuy.moniker(); // 'Tomhuda Katzdale'
```
@method aliasMethod
- @for Ember
+ @static
+ @for @ember/object
@param {String} methodName name of the method to alias
@public
*/
@@ -14377,26 +14551,30 @@
/**
Specify a method that observes property changes.
```javascript
- Ember.Object.extend({
- valueObserver: Ember.observer('value', function() {
+ import EmberObject from '@ember/object';
+ import { observer } from '@ember/object';
+
+ export default EmberObject.extend({
+ valueObserver: observer('value', function() {
// Executes whenever the "value" property changes
})
});
```
Also available as `Function.prototype.observes` if prototype extensions are
enabled.
@method observer
- @for Ember
+ @for @ember/object
@param {String} propertyNames*
@param {Function} func
@return func
@public
+ @static
*/
function observer() {
var _paths = void 0,
func = void 0,
_len5,
@@ -14408,23 +14586,23 @@
args[_key5] = arguments[_key5];
}
if (typeof args[args.length - 1] !== 'function') {
// revert to old, soft-deprecated argument ordering
- true && !false && emberDebug.deprecate('Passing the dependentKeys after the callback function in Ember.observer is deprecated. Ensure the callback function is the last argument.', false, { id: 'ember-metal.observer-argument-order', until: '3.0.0' });
+ true && !false && emberDebug.deprecate('Passing the dependentKeys after the callback function in observer is deprecated. Ensure the callback function is the last argument.', false, { id: 'ember-metal.observer-argument-order', until: '3.0.0' });
func = args.shift();
_paths = args;
} else {
func = args.pop();
_paths = args;
}
- true && !(typeof func === 'function') && emberDebug.assert('Ember.observer called without a function', typeof func === 'function');
+ true && !(typeof func === 'function') && emberDebug.assert('observer called without a function', typeof func === 'function');
true && !(_paths.length > 0 && _paths.every(function (p) {
return typeof p === 'string' && p.length;
- })) && emberDebug.assert('Ember.observer called without valid path', _paths.length > 0 && _paths.every(function (p) {
+ })) && emberDebug.assert('observer called without valid path', _paths.length > 0 && _paths.every(function (p) {
return typeof p === 'string' && p.length;
}));
var paths = [];
var addWatchedProperty = function (path) {
@@ -14441,28 +14619,30 @@
/**
Specify a method that observes property changes.
```javascript
- Ember.Object.extend({
+ import EmberObject from '@ember/object';
+
+ EmberObject.extend({
valueObserver: Ember.immediateObserver('value', function() {
// Executes whenever the "value" property changes
})
});
```
- In the future, `Ember.observer` may become asynchronous. In this event,
- `Ember.immediateObserver` will maintain the synchronous behavior.
+ In the future, `observer` may become asynchronous. In this event,
+ `immediateObserver` will maintain the synchronous behavior.
Also available as `Function.prototype.observesImmediately` if prototype extensions are
enabled.
@method _immediateObserver
@for Ember
@param {String} propertyNames*
@param {Function} func
- @deprecated Use `Ember.observer` instead.
+ @deprecated Use `observer` instead.
@return func
@private
*/
@@ -14483,10 +14663,15 @@
@private
*/
/**
+ @module ember
+ @private
+ */
+
+ /**
Read-only property that returns the result of a container lookup.
@class InjectedProperty
@namespace Ember
@constructor
@@ -14505,11 +14690,11 @@
function injectedPropertyGet(keyName) {
var desc = this[keyName];
var owner = emberUtils.getOwner(this) || this.container; // fallback to `container` for backwards compat
- true && !(desc && desc.isDescriptor && desc.type) && emberDebug.assert('InjectedProperties should be defined with the Ember.inject computed property macros.', desc && desc.isDescriptor && desc.type);
+ true && !(desc && desc.isDescriptor && desc.type) && emberDebug.assert('InjectedProperties should be defined with the inject computed property macros.', desc && desc.isDescriptor && desc.type);
true && !owner && emberDebug.assert('Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.', owner);
return owner.lookup(desc.type + ':' + (desc.name || keyName));
}
@@ -14554,15 +14739,10 @@
Descriptor$$1.prototype.teardown = function () {};
return Descriptor$$1;
}(Descriptor);
- /**
- @module ember
- @submodule ember-metal
- */
-
exports['default'] = Ember;
exports.computed = function () {
for (_len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
@@ -14722,14 +14902,14 @@
_len,
args,
_key;
var events = args;
- true && !(typeof func === 'function') && emberDebug.assert('Ember.on expects function as last argument', typeof func === 'function');
+ true && !(typeof func === 'function') && emberDebug.assert('on expects function as last argument', typeof func === 'function');
true && !(events.length > 0 && events.every(function (p) {
return typeof p === 'string' && p.length;
- })) && emberDebug.assert('Ember.on called without valid event names', events.length > 0 && events.every(function (p) {
+ })) && emberDebug.assert('on called without valid event names', events.length > 0 && events.every(function (p) {
return typeof p === 'string' && p.length;
}));
func.__ember_listens__ = events;
return func;
@@ -14850,11 +15030,11 @@
return new Alias(methodName);
};
exports._immediateObserver = function () {
var i, arg;
- true && !false && emberDebug.deprecate('Usage of `Ember.immediateObserver` is deprecated, use `Ember.observer` instead.', false, { id: 'ember-metal.immediate-observer', until: '3.0.0' });
+ true && !false && emberDebug.deprecate('Usage of `Ember.immediateObserver` is deprecated, use `observer` instead.', false, { id: 'ember-metal.immediate-observer', until: '3.0.0' });
for (i = 0; i < arguments.length; i++) {
arg = arguments[i];
true && !(typeof arg !== 'string' || arg.indexOf('.') === -1) && emberDebug.assert('Immediate observers must observe internal properties only, not properties on other objects.', typeof arg !== 'string' || arg.indexOf('.') === -1);
@@ -15238,11 +15418,10 @@
'use strict';
exports.default =
/**
@module ember
- @submodule ember-glimmer
*/
/**
A Glimmer2 AST transformation that replaces all instances of
@@ -15318,11 +15497,10 @@
'use strict';
exports.default =
/**
@module ember
- @submodule ember-glimmer
*/
/**
A Glimmer2 AST transformation that replaces all instances of
@@ -15500,11 +15678,10 @@
'use strict';
exports.default =
/**
@module ember
- @submodule ember-glimmer
*/
/**
A Glimmer2 AST transformation that replaces all instances of
@@ -15566,11 +15743,10 @@
}
};
};
/**
@module ember
- @submodule ember-glimmer
*/
/**
A Glimmer2 AST transformation that replaces all instances of
@@ -15642,11 +15818,10 @@
exports.default =
/**
@module ember
- @submodule ember-htmlbars
*/
/**
An HTMLBars AST transformation that replaces all instances of
@@ -15760,11 +15935,10 @@
'use strict';
exports.default =
/**
@module ember
- @submodule ember-glimmer
*/
/**
A Glimmer2 AST transformation that replaces all instances of
@@ -16149,11 +16323,10 @@
@static
@param ctx
*/
/**
@module ember
- @submodule ember-templates
*/
exports.default = function (_ref) {
var context = _ref.context,
hasTemplate = _ref.hasTemplate,
@@ -16324,11 +16497,10 @@
var templateJS = new Function('return ' + precompiledTemplateString)();
return template(templateJS);
};
/**
@module ember
- @submodule ember-template-compiler
*/
var template = void 0;
});
enifed('ember-template-compiler/system/precompile', ['exports', 'ember-template-compiler/system/compile-options', 'require'], function (exports, _compileOptions, _require2) {
'use strict';
@@ -16356,11 +16528,10 @@
return glimmerPrecompile(templateString, (0, _compileOptions.default)(options));
};
/**
@module ember
- @submodule ember-template-compiler
*/
var glimmerPrecompile = void 0;
});
enifed('ember-utils', ['exports'], function (exports) {
@@ -16416,10 +16587,14 @@
}
return str;
}
/**
+ @module @ember/object
+ */
+
+ /**
Previously we used `Ember.$.uuid`, however `$.uuid` has been removed from
jQuery master. We'll just bootstrap our own uuid now.
@private
@return {Number} the uuid
@@ -16490,11 +16665,12 @@
pass in. You will rarely need to use this method. Instead you should
call `Ember.guidFor(obj)`, which return an existing guid if available.
@private
@method generateGuid
- @for Ember
+ @static
+ @for @ember/object/internals
@param {Object} [obj] Object the guid will be used for. If passed in, the guid will
be saved on the object and reused whenever you pass the same object
again.
If no object is passed, just generate a new guid.
@@ -16511,12 +16687,13 @@
property.
You can also use this method on DOM Element objects.
@public
+ @static
@method guidFor
- @for Ember
+ @for @ember/object/internals
@param {Object} obj any object, string, number, Element, or primitive
@return {String} the unique guid for this instance.
*/
@@ -16527,12 +16704,11 @@
var id = GUID_KEY + Math.floor(Math.random() * new Date());
return intern('__' + debugName + '__ [id=' + id + ']');
}
/**
- @module ember
- @submodule ember-runtime
+ @module @ember/application
*/
var OWNER = symbol('OWNER');
/**
@@ -16550,11 +16726,11 @@
```app/components/play-audio.js
import Component from '@ember/component';
import { computed } from '@ember/object';
import { getOwner } from '@ember/application';
-
+
// Usage:
//
// {{play-audio audioType=model.audioType audioFile=model.file}}
//
export default Component.extend({
@@ -16569,11 +16745,12 @@
}
});
```
@method getOwner
- @for Ember
+ @static
+ @for @ember/application
@param {Object} object An object with an owner.
@return {Object} An owner object.
@since 2.3.0
@public
*/
@@ -16582,34 +16759,39 @@
/**
`setOwner` forces a new owner on a given object instance. This is primarily
useful in some testing cases.
@method setOwner
- @for Ember
+ @static
+ @for @ember/application
@param {Object} object An object instance.
@param {Object} object The new owner object of the object instance.
@since 2.3.0
@public
*/
/**
+ @module @ember/polyfills
+ */
+ /**
Copy properties from a source object to a target object.
```javascript
var a = { first: 'Yehuda' };
var b = { last: 'Katz' };
var c = { company: 'Tilde Inc.' };
Ember.assign(a, b, c); // a === { first: 'Yehuda', last: 'Katz', company: 'Tilde Inc.' }, b === { last: 'Katz' }, c === { company: 'Tilde Inc.' }
```
@method assign
- @for Ember
+ @for @ember/polyfills
@param {Object} original The object to assign into
@param {Object} ...args The objects to copy properties from
@return {Object}
@public
+ @static
*/
function assign(original) {
var i, arg, updates, _i, prop;
for (i = 1; i < arguments.length; i++) {
@@ -16700,20 +16882,22 @@
return superWrapper;
}
var objectToString = Object.prototype.toString;
-
/**
+ @module @ember/debug
+ */
+ /**
Convenience method to inspect an object. This method will attempt to
convert the object into a useful string description.
It is a pretty simple implementation. If you want something more robust,
use something like JSDump: https://github.com/NV/jsDump
@method inspect
- @for Ember
+ @static
@param {Object} obj The object you want to inspect.
@return {String} A description of the object
@since 1.4.0
@private
*/
@@ -16791,10 +16975,13 @@
var isArray = Array.isArray;
/**
+ @module @ember/array
+ */
+ /**
Forces the passed object to be part of an array. If the object is already
an array, it will return the object. Otherwise, it will add the object to
an array. If obj is `null` or `undefined`, it will return an empty array.
```javascript
@@ -16808,11 +16995,12 @@
Ember.makeArray(controller) === controller; // true
```
@method makeArray
- @for Ember
+ @static
+ @for @ember/array
@param {Object} obj the object
@return {Array}
@private
*/
@@ -17103,10 +17291,10 @@
exports.EMBER_GLIMMER_DETECT_BACKTRACKING_RERENDER = FEATURES["ember-glimmer-detect-backtracking-rerender"];
});
enifed("ember/version", ["exports"], function (exports) {
"use strict";
- exports.default = "2.16.0";
+ exports.default = "2.16.1";
});
enifed("handlebars", ["exports"], function (exports) {
"use strict";
// File ignored in coverage tests via setting in .istanbul.yml