` (or any of the other element customization behaviors of [@ember/component](/ember/release/classes/Component)).
Specifically, this means that the template will be rendered as "outer HTML".
-
+
In general, this method will be used by build time tooling and would not be directly written in an application. However,
at times it may be useful to use directly to leverage the "outer HTML" semantics mentioned above. For example, if an addon would like
to use these semantics for its templates but cannot be certain it will only be consumed by applications that have enabled the
`template-only-glimmer-components` optional feature.
-
+
@example
-
+
```js
import templateOnly from '@ember/component/template-only';
-
+
export default templateOnly();
```
-
+
@public
@method templateOnly
@param {String} moduleName the module name that the template only component represents, this will be used for debugging purposes
@@ -35869,35 +35869,35 @@ define("@ember/controller/index", ["exports", "@ember/-internals/runtime", "@emb
/**
Creates a property that lazily looks up another controller in the container.
Can only be used when defining another controller.
-
+
Example:
-
+
```app/controllers/post.js
import Controller, {
inject as controller
} from '@ember/controller';
-
+
export default class PostController extends Controller {
@controller posts;
}
```
-
+
Classic Class Example:
-
+
```app/controllers/post.js
import Controller, {
inject as controller
} from '@ember/controller';
-
+
export default Controller.extend({
posts: controller()
});
```
-
+
This example will create a `posts` property on the `post` controller that
looks up the `posts` controller in the container, making it easy to reference
other controllers.
-
+
@method inject
@static
@for @ember/controller
@@ -36314,10 +36314,10 @@ define("@ember/debug/lib/capture-render-tree", ["exports", "@glimmer/util"], fun
/**
Ember Inspector calls this function to capture the current render tree.
-
+
In production mode, this requires turning on `ENV._DEBUG_RENDER_TREE`
before loading Ember.
-
+
@private
@static
@method captureRenderTree
@@ -36350,10 +36350,10 @@ define("@ember/debug/lib/deprecate", ["exports", "@ember/-internals/environment"
Deprecations are invoked by calls to [@ember/debug/deprecate](/ember/release/classes/@ember%2Fdebug/methods/deprecate?anchor=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
import { registerDeprecationHandler } from '@ember/debug';
-
+
registerDeprecationHandler((message, options, next) => {
if (message.indexOf('should') !== -1) {
throw new Error(`Deprecation message with should: ${message}`);
@@ -36363,9 +36363,9 @@ define("@ember/debug/lib/deprecate", ["exports", "@ember/-internals/environment"
}
});
```
-
+
The handler function takes the following arguments:
-
+
message
- The message received from the deprecation call.
options
- An object passed in with the deprecation call containing additional information including:
@@ -36375,7 +36375,7 @@ define("@ember/debug/lib/deprecate", ["exports", "@ember/-internals/environment"
next
- A function that calls into the previously registered handler.
-
+
@public
@static
@method registerDeprecationHandler
@@ -36749,14 +36749,14 @@ define("@ember/engine/index", ["exports", "@ember/engine/lib/engine-parent", "@e
/**
The `Engine` class contains core functionality for both applications and
engines.
-
+
Each engine manages a registry that's used for dependency injection and
exposed through `RegistryProxy`.
-
+
Engines also manage initializers and instance initializers.
-
+
Engines can spawn `EngineInstance` instances via `buildInstance()`.
-
+
@class Engine
@extends Ember.Namespace
@uses RegistryProxy
@@ -37096,15 +37096,15 @@ define("@ember/engine/index", ["exports", "@ember/engine/lib/engine-parent", "@e
});
/**
This function defines the default lookup rules for container lookups:
-
+
* templates are looked up on `Ember.TEMPLATES`
* other names are looked up on the application after classifying the name.
For example, `controller:post` looks up `App.PostController` by default.
* if the default lookup fails, look for registered classes on the container
-
+
This allows the application to register default injections in the container
that could be overridden by the normal naming convention.
-
+
@private
@method resolverFor
@param {Ember.Namespace} namespace the namespace to look for classes
@@ -37191,7 +37191,7 @@ define("@ember/engine/instance", ["exports", "@ember/-internals/runtime", "@embe
/**
The `EngineInstance` encapsulates all of the stateful aspects of a
running `Engine`.
-
+
@public
@class EngineInstance
@extends EmberObject
@@ -37386,7 +37386,7 @@ define("@ember/engine/lib/engine-parent", ["exports", "@ember/-internals/utils"]
var ENGINE_PARENT = (0, _utils.symbol)('ENGINE_PARENT');
/**
`getEngineParent` retrieves an engine instance's parent instance.
-
+
@method getEngineParent
@param {EngineInstance} engine An engine instance.
@return {EngineInstance} The parent engine instance.
@@ -37400,7 +37400,7 @@ define("@ember/engine/lib/engine-parent", ["exports", "@ember/-internals/utils"]
}
/**
`setEngineParent` sets an engine instance's parent instance.
-
+
@method setEngineParent
@param {EngineInstance} engine An engine instance.
@param {EngineInstance} parent The parent engine instance.
@@ -37426,7 +37426,7 @@ define("@ember/error/index", ["exports"], function (_exports) {
/**
The JavaScript Error object used by Ember.assert.
-
+
@class Error
@namespace Ember
@extends Error
@@ -37462,48 +37462,48 @@ define("@ember/instrumentation/index", ["exports", "@ember/-internals/environmen
The purpose of the Ember Instrumentation module is
to provide efficient, general-purpose instrumentation
for Ember.
-
+
Subscribe to a listener by using `subscribe`:
-
+
```javascript
import { subscribe } from '@ember/instrumentation';
-
+
subscribe("render", {
before(name, timestamp, payload) {
-
+
},
-
+
after(name, timestamp, payload) {
-
+
}
});
```
-
+
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 `instrument`:
-
+
```javascript
import { instrument } from '@ember/instrumentation';
-
+
instrument("render.handlebars", payload, function() {
// rendering logic
}, binding);
```
-
+
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`,
and the subscriber listened for all events beginning with
`render`. It would receive callbacks for events named
`render`, `render.handlebars`, `render.container`, or
even `render.handlebars.layout`.
-
+
@class Instrumentation
@static
@private
@@ -37646,14 +37646,14 @@ define("@ember/instrumentation/index", ["exports", "@ember/-internals/environmen
}
/**
Subscribes to a particular event or instrumented block of code.
-
+
@method subscribe
@for @ember/instrumentation
@static
-
+
@param {String} [pattern] Namespaced event name.
@param {Object} [object] Before and After hooks.
-
+
@return {Subscriber}
@private
*/
@@ -37687,11 +37687,11 @@ define("@ember/instrumentation/index", ["exports", "@ember/-internals/environmen
}
/**
Unsubscribes from a particular event or instrumented block of code.
-
+
@method unsubscribe
@for @ember/instrumentation
@static
-
+
@param {Object} [subscriber]
@private
*/
@@ -37711,7 +37711,7 @@ define("@ember/instrumentation/index", ["exports", "@ember/-internals/environmen
}
/**
Resets `Instrumentation` by flushing list of subscribers.
-
+
@method reset
@for @ember/instrumentation
@static
@@ -37990,11 +37990,11 @@ define("@ember/object/index", ["exports", "@ember/debug", "@ember/polyfills", "@
/**
Decorator that turns the target function into an Action which can be accessed
directly by reference.
-
+
```js
import Component from '@ember/component';
import { action, set } from '@ember/object';
-
+
export default class Tooltip extends Component {
@action
toggleShowing() {
@@ -38005,30 +38005,30 @@ define("@ember/object/index", ["exports", "@ember/debug", "@ember/polyfills", "@
```hbs
Show tooltip
-
+
{{#if isShowing}}
I'm a tooltip!
{{/if}}
```
-
+
Decorated actions also interop with the string style template actions:
-
+
```hbs
Show tooltip
-
+
{{#if isShowing}}
I'm a tooltip!
{{/if}}
```
-
+
It also binds the function directly to the instance, so it can be used in any
context and will correctly refer to the class it came from:
-
+
```hbs
Show tooltip
-
+
{{#if isShowing}}
I'm a tooltip!
{{/if}}
```
-
+
This can also be used in JavaScript code directly:
-
+
```js
import Component from '@ember/component';
import { action, set } from '@ember/object';
-
+
export default class Tooltip extends Component {
constructor() {
super(...arguments);
-
+
// this.toggleShowing is still bound correctly when added to
// the event listener
document.addEventListener('click', this.toggleShowing);
}
-
+
@action
toggleShowing() {
set(this, 'isShowing', !this.isShowing);
}
}
```
-
+
This is considered best practice, since it means that methods will be bound
correctly no matter where they are used. By contrast, the `{{action}}` helper
and modifier can also be used to bind context, but it will be required for
every usage of the method:
-
+
```hbs
Show tooltip
-
+
{{#if isShowing}}
I'm a tooltip!
{{/if}}
```
-
+
They also do not have equivalents in JavaScript directly, so they cannot be
used for other situations where binding would be useful.
-
+
@public
@method action
@for @ember/object
@@ -38222,49 +38222,49 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
/**
A computed property macro that returns true if the value of the dependent
property is null, an empty string, empty array, or empty function.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { empty } from '@ember/object/computed';
-
+
class ToDoList {
constructor(todos) {
set(this, 'todos', todos);
}
-
+
@empty('todos') isDone;
}
-
+
let todoList = new ToDoList(
['Unit Test', 'Documentation', 'Release']
);
-
+
todoList.isDone; // false
set(todoList, 'todos', []);
todoList.isDone; // true
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { empty } from '@ember/object/computed';
-
+
let ToDoList = EmberObject.extend({
isDone: empty('todos')
});
-
+
let todoList = ToDoList.create({
todos: ['Unit Test', 'Documentation', 'Release']
});
-
+
todoList.isDone; // false
set(todoList, 'todos', []);
todoList.isDone; // true
```
-
+
@since 1.6.0
@method empty
@static
@@ -38273,7 +38273,7 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
@return {ComputedProperty} computed property which returns true if the value
of the dependent property is null, an empty string, empty array, or empty
function and false if the underlying value is not empty.
-
+
@public
*/
@@ -38287,49 +38287,49 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
/**
A computed property that returns true if the value of the dependent property
is NOT null, an empty string, empty array, or empty function.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { notEmpty } from '@ember/object/computed';
-
+
class Hamster {
constructor(backpack) {
set(this, 'backpack', backpack);
}
-
+
@notEmpty('backpack') hasStuff
}
-
+
let hamster = new Hamster(
['Food', 'Sleeping Bag', 'Tent']
);
-
+
hamster.hasStuff; // true
set(hamster, 'backpack', []);
hamster.hasStuff; // false
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { notEmpty } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
hasStuff: notEmpty('backpack')
});
-
+
let hamster = Hamster.create({
backpack: ['Food', 'Sleeping Bag', 'Tent']
});
-
+
hamster.hasStuff; // true
set(hamster, 'backpack', []);
hamster.hasStuff; // false
```
-
+
@method notEmpty
@static
@for @ember/object/computed
@@ -38350,47 +38350,47 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
A computed property that returns true if the value of the dependent property
is null or undefined. This avoids errors from JSLint complaining about use of
==, which can be technically confusing.
-
+
```javascript
import { set } from '@ember/object';
import { none } from '@ember/object/computed';
-
+
class Hamster {
@none('food') isHungry;
}
-
+
let hamster = new Hamster();
-
+
hamster.isHungry; // true
-
+
set(hamster, 'food', 'Banana');
hamster.isHungry; // false
-
+
set(hamster, 'food', null);
hamster.isHungry; // true
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { none } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
isHungry: none('food')
});
-
+
let hamster = Hamster.create();
-
+
hamster.isHungry; // true
-
+
set(hamster, 'food', 'Banana');
hamster.isHungry; // false
-
+
set(hamster, 'food', null);
hamster.isHungry; // true
```
-
+
@method none
@static
@for @ember/object/computed
@@ -38410,45 +38410,45 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
/**
A computed property that returns the inverse boolean value of the original
value for the dependent property.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { not } from '@ember/object/computed';
-
+
class User {
loggedIn = false;
-
+
@not('loggedIn') isAnonymous;
}
-
+
let user = new User();
-
+
user.isAnonymous; // true
set(user, 'loggedIn', true);
user.isAnonymous; // false
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { not } from '@ember/object/computed';
-
+
let User = EmberObject.extend({
loggedIn: false,
-
+
isAnonymous: not('loggedIn')
});
-
+
let user = User.create();
-
+
user.isAnonymous; // true
set(user, 'loggedIn', true);
user.isAnonymous; // false
```
-
+
@method not
@static
@for @ember/object/computed
@@ -38468,57 +38468,57 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
/**
A computed property that converts the provided dependent property into a
boolean value.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { bool } from '@ember/object/computed';
-
-
+
+
class Hamster {
@bool('numBananas') hasBananas
}
-
+
let hamster = new Hamster();
-
+
hamster.hasBananas; // false
-
+
set(hamster, 'numBananas', 0);
hamster.hasBananas; // false
-
+
set(hamster, 'numBananas', 1);
hamster.hasBananas; // true
-
+
set(hamster, 'numBananas', null);
hamster.hasBananas; // false
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { bool } from '@ember/object/computed';
-
-
+
+
let Hamster = EmberObject.extend({
hasBananas: bool('numBananas')
});
-
+
let hamster = Hamster.create();
-
+
hamster.hasBananas; // false
-
+
set(hamster, 'numBananas', 0);
hamster.hasBananas; // false
-
+
set(hamster, 'numBananas', 1);
hamster.hasBananas; // true
-
+
set(hamster, 'numBananas', null);
hamster.hasBananas; // false
```
-
+
@method bool
@static
@for @ember/object/computed
@@ -38539,49 +38539,49 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
A computed property which matches the original value for the dependent
property against a given RegExp, returning `true` if the value matches the
RegExp and `false` if it does not.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { match } from '@ember/object/computed';
-
+
class User {
@match('email', /^.+@.+\..+$/) hasValidEmail;
}
-
+
let user = new User();
-
+
user.hasValidEmail; // false
-
+
set(user, 'email', '');
user.hasValidEmail; // false
-
+
set(user, 'email', 'ember_hamster@example.com');
user.hasValidEmail; // true
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { match } from '@ember/object/computed';
-
+
let User = EmberObject.extend({
hasValidEmail: match('email', /^.+@.+\..+$/)
});
-
+
let user = User.create();
-
+
user.hasValidEmail; // false
-
+
set(user, 'email', '');
user.hasValidEmail; // false
-
+
set(user, 'email', 'ember_hamster@example.com');
user.hasValidEmail; // true
```
-
+
@method match
@static
@for @ember/object/computed
@@ -38603,49 +38603,49 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
/**
A computed property that returns true if the provided dependent property is
equal to the given value.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { equal } from '@ember/object/computed';
-
+
class Hamster {
@equal('percentCarrotsEaten', 100) satisfied;
}
-
+
let hamster = new Hamster();
-
+
hamster.satisfied; // false
-
+
set(hamster, 'percentCarrotsEaten', 100);
hamster.satisfied; // true
-
+
set(hamster, 'percentCarrotsEaten', 50);
hamster.satisfied; // false
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { equal } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
satisfied: equal('percentCarrotsEaten', 100)
});
-
+
let hamster = Hamster.create();
-
+
hamster.satisfied; // false
-
+
set(hamster, 'percentCarrotsEaten', 100);
hamster.satisfied; // true
-
+
set(hamster, 'percentCarrotsEaten', 50);
hamster.satisfied; // false
```
-
+
@method equal
@static
@for @ember/object/computed
@@ -38666,49 +38666,49 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
/**
A computed property that returns true if the provided dependent property is
greater than the provided value.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { gt } from '@ember/object/computed';
-
+
class Hamster {
@gt('numBananas', 10) hasTooManyBananas;
}
-
+
let hamster = new Hamster();
-
+
hamster.hasTooManyBananas; // false
-
+
set(hamster, 'numBananas', 3);
hamster.hasTooManyBananas; // false
-
+
set(hamster, 'numBananas', 11);
hamster.hasTooManyBananas; // true
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { gt } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
hasTooManyBananas: gt('numBananas', 10)
});
-
+
let hamster = Hamster.create();
-
+
hamster.hasTooManyBananas; // false
-
+
set(hamster, 'numBananas', 3);
hamster.hasTooManyBananas; // false
-
+
set(hamster, 'numBananas', 11);
hamster.hasTooManyBananas; // true
```
-
+
@method gt
@static
@for @ember/object/computed
@@ -38729,49 +38729,49 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
/**
A computed property that returns true if the provided dependent property is
greater than or equal to the provided value.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { gte } from '@ember/object/computed';
-
+
class Hamster {
@gte('numBananas', 10) hasTooManyBananas;
}
-
+
let hamster = new Hamster();
-
+
hamster.hasTooManyBananas; // false
-
+
set(hamster, 'numBananas', 3);
hamster.hasTooManyBananas; // false
-
+
set(hamster, 'numBananas', 10);
hamster.hasTooManyBananas; // true
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { gte } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
hasTooManyBananas: gte('numBananas', 10)
});
-
+
let hamster = Hamster.create();
-
+
hamster.hasTooManyBananas; // false
-
+
set(hamster, 'numBananas', 3);
hamster.hasTooManyBananas; // false
-
+
set(hamster, 'numBananas', 10);
hamster.hasTooManyBananas; // true
```
-
+
@method gte
@static
@for @ember/object/computed
@@ -38792,49 +38792,49 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
/**
A computed property that returns true if the provided dependent property is
less than the provided value.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { lt } from '@ember/object/computed';
-
+
class Hamster {
@lt('numBananas', 3) needsMoreBananas;
}
-
+
let hamster = new Hamster();
-
+
hamster.needsMoreBananas; // true
-
+
set(hamster, 'numBananas', 3);
hamster.needsMoreBananas; // false
-
+
set(hamster, 'numBananas', 2);
hamster.needsMoreBananas; // true
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { lt } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
needsMoreBananas: lt('numBananas', 3)
});
-
+
let hamster = Hamster.create();
-
+
hamster.needsMoreBananas; // true
-
+
set(hamster, 'numBananas', 3);
hamster.needsMoreBananas; // false
-
+
set(hamster, 'numBananas', 2);
hamster.needsMoreBananas; // true
```
-
+
@method lt
@static
@for @ember/object/computed
@@ -38855,49 +38855,49 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
/**
A computed property that returns true if the provided dependent property is
less than or equal to the provided value.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { lte } from '@ember/object/computed';
-
+
class Hamster {
@lte('numBananas', 3) needsMoreBananas;
}
-
+
let hamster = new Hamster();
-
+
hamster.needsMoreBananas; // true
-
+
set(hamster, 'numBananas', 5);
hamster.needsMoreBananas; // false
-
+
set(hamster, 'numBananas', 3);
hamster.needsMoreBananas; // true
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { lte } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
needsMoreBananas: lte('numBananas', 3)
});
-
+
let hamster = Hamster.create();
-
+
hamster.needsMoreBananas; // true
-
+
set(hamster, 'numBananas', 5);
hamster.needsMoreBananas; // false
-
+
set(hamster, 'numBananas', 3);
hamster.needsMoreBananas; // true
```
-
+
@method lte
@static
@for @ember/object/computed
@@ -38918,67 +38918,67 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
/**
A computed property that performs a logical `and` on the original values for
the provided dependent properties.
-
+
You may pass in more than two properties and even use property brace
expansion. The computed property will return the first falsy value or last
truthy value just like JavaScript's `&&` operator.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { and } from '@ember/object/computed';
-
+
class Hamster {
@and('hasTent', 'hasBackpack') readyForCamp;
@and('hasWalkingStick', 'hasBackpack') readyForHike;
}
-
+
let tomster = new Hamster();
-
+
tomster.readyForCamp; // false
-
+
set(tomster, 'hasTent', true);
tomster.readyForCamp; // false
-
+
set(tomster, 'hasBackpack', true);
tomster.readyForCamp; // true
-
+
set(tomster, 'hasBackpack', 'Yes');
tomster.readyForCamp; // 'Yes'
-
+
set(tomster, 'hasWalkingStick', null);
tomster.readyForHike; // null
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { and } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
readyForCamp: and('hasTent', 'hasBackpack'),
readyForHike: and('hasWalkingStick', 'hasBackpack')
});
-
+
let tomster = Hamster.create();
-
+
tomster.readyForCamp; // false
-
+
set(tomster, 'hasTent', true);
tomster.readyForCamp; // false
-
+
set(tomster, 'hasBackpack', true);
tomster.readyForCamp; // true
-
+
set(tomster, 'hasBackpack', 'Yes');
tomster.readyForCamp; // 'Yes'
-
+
set(tomster, 'hasWalkingStick', null);
tomster.readyForHike; // null
```
-
+
@method and
@static
@for @ember/object/computed
@@ -38993,61 +38993,61 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
/**
A computed property which performs a logical `or` on the original values for
the provided dependent properties.
-
+
You may pass in more than two properties and even use property brace
expansion. The computed property will return the first truthy value or last
falsy value just like JavaScript's `||` operator.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { or } from '@ember/object/computed';
-
+
class Hamster {
@or('hasJacket', 'hasUmbrella') readyForRain;
@or('hasSunscreen', 'hasUmbrella') readyForBeach;
}
-
+
let tomster = new Hamster();
-
+
tomster.readyForRain; // undefined
-
+
set(tomster, 'hasUmbrella', true);
tomster.readyForRain; // true
-
+
set(tomster, 'hasJacket', 'Yes');
tomster.readyForRain; // 'Yes'
-
+
set(tomster, 'hasSunscreen', 'Check');
tomster.readyForBeach; // 'Check'
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { or } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
readyForRain: or('hasJacket', 'hasUmbrella'),
readyForBeach: or('hasSunscreen', 'hasUmbrella')
});
-
+
let tomster = Hamster.create();
-
+
tomster.readyForRain; // undefined
-
+
set(tomster, 'hasUmbrella', true);
tomster.readyForRain; // true
-
+
set(tomster, 'hasJacket', 'Yes');
tomster.readyForRain; // 'Yes'
-
+
set(tomster, 'hasSunscreen', 'Check');
tomster.readyForBeach; // 'Check'
```
-
+
@method or
@static
@for @ember/object/computed
@@ -39063,49 +39063,49 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
Creates a new property that is an alias for another property on an object.
Calls to `get` or `set` this property behave as though they were called on the
original property.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { alias } from '@ember/object/computed';
-
+
class Person {
name = 'Alex Matchneer';
-
+
@alias('name') nomen;
}
-
+
let alex = new Person();
-
+
alex.nomen; // 'Alex Matchneer'
alex.name; // 'Alex Matchneer'
-
+
set(alex, 'nomen', '@machty');
alex.name; // '@machty'
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { alias } from '@ember/object/computed';
-
+
let Person = EmberObject.extend({
name: 'Alex Matchneer',
-
+
nomen: alias('name')
});
-
+
let alex = Person.create();
-
+
alex.nomen; // 'Alex Matchneer'
alex.name; // 'Alex Matchneer'
-
+
set(alex, 'nomen', '@machty');
alex.name; // '@machty'
```
-
+
@method alias
@static
@for @ember/object/computed
@@ -39121,56 +39121,56 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
not mutate the upstream property, rather causes the current property to become
the value set. This causes the downstream property to permanently diverge from
the upstream property.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { oneWay }from '@ember/object/computed';
-
+
class User {
constructor(firstName, lastName) {
set(this, 'firstName', firstName);
set(this, 'lastName', lastName);
}
-
+
@oneWay('firstName') nickName;
}
-
+
let teddy = new User('Teddy', 'Zeenny');
-
+
teddy.nickName; // 'Teddy'
-
+
set(teddy, 'nickName', 'TeddyBear');
teddy.firstName; // 'Teddy'
teddy.nickName; // 'TeddyBear'
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { oneWay } from '@ember/object/computed';
-
+
let User = EmberObject.extend({
firstName: null,
lastName: null,
-
+
nickName: oneWay('firstName')
});
-
+
let teddy = User.create({
firstName: 'Teddy',
lastName: 'Zeenny'
});
-
+
teddy.nickName; // 'Teddy'
-
+
set(teddy, 'nickName', 'TeddyBear'); // 'TeddyBear'
teddy.firstName; // 'Teddy'
teddy.nickName; // 'TeddyBear'
```
-
+
@method oneWay
@static
@for @ember/object/computed
@@ -39189,7 +39189,7 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
/**
This is a more semantically meaningful alias of `computed.oneWay`, whose name
is somewhat ambiguous as to which direction the data flows.
-
+
@method reads
@static
@for @ember/object/computed
@@ -39203,60 +39203,60 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
Where `computed.oneWay` provides oneWay bindings, `computed.readOnly` provides
a readOnly one way binding. Very often when using `computed.oneWay` one does
not also want changes to propagate back up, as they will replace the value.
-
+
This prevents the reverse flow, and also throws an exception when it occurs.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { readOnly } from '@ember/object/computed';
-
+
class User {
constructor(firstName, lastName) {
set(this, 'firstName', firstName);
set(this, 'lastName', lastName);
}
-
+
@readOnly('firstName') nickName;
});
-
+
let teddy = new User('Teddy', 'Zeenny');
-
+
teddy.nickName; // 'Teddy'
-
+
set(teddy, 'nickName', 'TeddyBear'); // throws Exception
// throw new EmberError('Cannot Set: nickName on:
' );`
-
+
teddy.firstName; // 'Teddy'
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { readOnly } from '@ember/object/computed';
-
+
let User = EmberObject.extend({
firstName: null,
lastName: null,
-
+
nickName: readOnly('firstName')
});
-
+
let teddy = User.create({
firstName: 'Teddy',
lastName: 'Zeenny'
});
-
+
teddy.nickName; // 'Teddy'
-
+
set(teddy, 'nickName', 'TeddyBear'); // throws Exception
// throw new EmberError('Cannot Set: nickName on: ' );`
-
+
teddy.firstName; // 'Teddy'
```
-
+
@method readOnly
@static
@for @ember/object/computed
@@ -39276,13 +39276,13 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
Creates a new property that is an alias for another property on an object.
Calls to `get` or `set` this property behave as though they were called on the
original property, but also print a deprecation warning.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { deprecatingAlias } from '@ember/object/computed';
-
+
class Hamster {
@deprecatingAlias('cavendishCount', {
id: 'hamster.deprecate-banana',
@@ -39290,32 +39290,32 @@ define("@ember/object/lib/computed/computed_macros", ["exports", "@ember/-intern
})
bananaCount;
}
-
+
let hamster = new Hamster();
-
+
set(hamster, 'bananaCount', 5); // Prints a deprecation warning.
hamster.cavendishCount; // 5
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { deprecatingAlias } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
bananaCount: deprecatingAlias('cavendishCount', {
id: 'hamster.deprecate-banana',
until: '3.0.0'
})
});
-
+
let hamster = Hamster.create();
-
+
set(hamster, 'bananaCount', 5); // Prints a deprecation warning.
hamster.cavendishCount; // 5
```
-
+
@method deprecatingAlias
@static
@for @ember/object/computed
@@ -39415,40 +39415,40 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
}
/**
A computed property that returns the sum of the values in the dependent array.
-
+
Example:
-
+
```javascript
import { sum } from '@ember/object/computed';
-
+
class Invoice {
lineItems = [1.00, 2.50, 9.99];
-
+
@sum('lineItems') total;
}
-
+
let invoice = new Invoice();
-
+
invoice.total; // 13.49
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject from '@ember/object';
import { sum } from '@ember/object/computed';
-
+
let Invoice = EmberObject.extend({
lineItems: [1.00, 2.50, 9.99],
-
+
total: sum('lineItems')
})
-
+
let invoice = Invoice.create();
-
+
invoice.total; // 13.49
```
-
+
@method sum
@for @ember/object/computed
@static
@@ -39467,24 +39467,24 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
/**
A computed property that calculates the maximum value in the dependent array.
This will return `-Infinity` when the dependent array is empty.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { mapBy, max } from '@ember/object/computed';
-
+
class Person {
children = [];
-
+
@mapBy('children', 'age') childAges;
@max('childAges') maxChildAge;
}
-
+
let lordByron = new Person();
-
+
lordByron.maxChildAge; // -Infinity
-
+
set(lordByron, 'children', [
{
name: 'Augusta Ada Byron',
@@ -39492,7 +39492,7 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
}
]);
lordByron.maxChildAge; // 7
-
+
set(lordByron, 'children', [
...lordByron.children,
{
@@ -39505,22 +39505,22 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
]);
lordByron.maxChildAge; // 8
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { mapBy, max } from '@ember/object/computed';
-
+
let Person = EmberObject.extend({
childAges: mapBy('children', 'age'),
maxChildAge: max('childAges')
});
-
+
let lordByron = Person.create({ children: [] });
-
+
lordByron.maxChildAge; // -Infinity
-
+
set(lordByron, 'children', [
{
name: 'Augusta Ada Byron',
@@ -39528,7 +39528,7 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
}
]);
lordByron.maxChildAge; // 7
-
+
set(lordByron, 'children', [
...lordByron.children,
{
@@ -39541,12 +39541,12 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
]);
lordByron.maxChildAge; // 8
```
-
+
If the types of the arguments are not numbers, they will be converted to
numbers and the type of the return value will always be `Number`. For example,
the max of a list of Date objects will be the highest timestamp as a `Number`.
This behavior is consistent with `Math.max`.
-
+
@method max
@for @ember/object/computed
@static
@@ -39564,24 +39564,24 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
/**
A computed property that calculates the minimum value in the dependent array.
This will return `Infinity` when the dependent array is empty.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { mapBy, min } from '@ember/object/computed';
-
+
class Person {
children = [];
-
+
@mapBy('children', 'age') childAges;
@min('childAges') minChildAge;
}
-
+
let lordByron = Person.create({ children: [] });
-
+
lordByron.minChildAge; // Infinity
-
+
set(lordByron, 'children', [
{
name: 'Augusta Ada Byron',
@@ -39589,7 +39589,7 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
}
]);
lordByron.minChildAge; // 7
-
+
set(lordByron, 'children', [
...lordByron.children,
{
@@ -39602,22 +39602,22 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
]);
lordByron.minChildAge; // 5
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { mapBy, min } from '@ember/object/computed';
-
+
let Person = EmberObject.extend({
childAges: mapBy('children', 'age'),
minChildAge: min('childAges')
});
-
+
let lordByron = Person.create({ children: [] });
-
+
lordByron.minChildAge; // Infinity
-
+
set(lordByron, 'children', [
{
name: 'Augusta Ada Byron',
@@ -39625,7 +39625,7 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
}
]);
lordByron.minChildAge; // 7
-
+
set(lordByron, 'children', [
...lordByron.children,
{
@@ -39638,12 +39638,12 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
]);
lordByron.minChildAge; // 5
```
-
+
If the types of the arguments are not numbers, they will be converted to
numbers and the type of the return value will always be `Number`. For example,
the min of a list of Date objects will be the lowest timestamp as a `Number`.
This behavior is consistent with `Math.min`.
-
+
@method min
@for @ember/object/computed
@static
@@ -39659,70 +39659,70 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
}
/**
Returns an array mapped via the callback
-
+
The callback method you provide should have the following signature:
- `item` is the current item in the iteration.
- `index` is the integer index of the current item in the iteration.
-
+
```javascript
function mapCallback(item, index);
```
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { map } from '@ember/object/computed';
-
+
class Hamster {
constructor(chores) {
set(this, 'chores', chores);
}
-
+
@map('chores', function(chore, index) {
return `${chore.toUpperCase()}!`;
})
excitingChores;
});
-
+
let hamster = new Hamster(['clean', 'write more unit tests']);
-
+
hamster.excitingChores; // ['CLEAN!', 'WRITE MORE UNIT TESTS!']
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject from '@ember/object';
import { map } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
excitingChores: map('chores', function(chore, index) {
return `${chore.toUpperCase()}!`;
})
});
-
+
let hamster = Hamster.create({
chores: ['clean', 'write more unit tests']
});
-
+
hamster.excitingChores; // ['CLEAN!', 'WRITE MORE UNIT TESTS!']
```
-
+
You can optionally pass an array of additional dependent keys as the second
parameter to the macro, if your map function relies on any external values:
-
+
```javascript
import { set } from '@ember/object';
import { map } from '@ember/object/computed';
-
+
class Hamster {
shouldUpperCase = false;
-
+
constructor(chores) {
set(this, 'chores', chores);
}
-
+
@map('chores', ['shouldUpperCase'], function(chore, index) {
if (this.shouldUpperCase) {
return `${chore.toUpperCase()}!`;
@@ -39732,15 +39732,15 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
})
excitingChores;
}
-
+
let hamster = new Hamster(['clean', 'write more unit tests']);
-
+
hamster.excitingChores; // ['clean!', 'write more unit tests!']
-
+
set(hamster, 'shouldUpperCase', true);
hamster.excitingChores; // ['CLEAN!', 'WRITE MORE UNIT TESTS!']
```
-
+
@method map
@for @ember/object/computed
@static
@@ -39769,23 +39769,23 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
}
/**
Returns an array mapped to the specified key.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { mapBy } from '@ember/object/computed';
-
+
class Person {
children = [];
-
+
@mapBy('children', 'age') childAges;
}
-
+
let lordByron = new Person();
-
+
lordByron.childAges; // []
-
+
set(lordByron, 'children', [
{
name: 'Augusta Ada Byron',
@@ -39793,7 +39793,7 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
}
]);
lordByron.childAges; // [7]
-
+
set(lordByron, 'children', [
...lordByron.children,
{
@@ -39806,21 +39806,21 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
]);
lordByron.childAges; // [7, 5, 8]
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { mapBy } from '@ember/object/computed';
-
+
let Person = EmberObject.extend({
childAges: mapBy('children', 'age')
});
-
+
let lordByron = Person.create({ children: [] });
-
+
lordByron.childAges; // []
-
+
set(lordByron, 'children', [
{
name: 'Augusta Ada Byron',
@@ -39828,7 +39828,7 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
}
]);
lordByron.childAges; // [7]
-
+
set(lordByron, 'children', [
...lordByron.children,
{
@@ -39841,7 +39841,7 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
]);
lordByron.childAges; // [7, 5, 8]
```
-
+
@method mapBy
@for @ember/object/computed
@static
@@ -39860,54 +39860,54 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
}
/**
Filters the array by the callback.
-
+
The callback method you provide should have the following signature:
- `item` is the current item in the iteration.
- `index` is the integer index of the current item in the iteration.
- `array` is the dependant array itself.
-
+
```javascript
function filterCallback(item, index, array);
```
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { filter } from '@ember/object/computed';
-
+
class Hamster {
constructor(chores) {
set(this, 'chores', chores);
}
-
+
@filter('chores', function(chore, index, array) {
return !chore.done;
})
remainingChores;
}
-
+
let hamster = Hamster.create([
{ name: 'cook', done: true },
{ name: 'clean', done: true },
{ name: 'write more unit tests', done: false }
]);
-
+
hamster.remainingChores; // [{name: 'write more unit tests', done: false}]
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject from '@ember/object';
import { filter } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
remainingChores: filter('chores', function(chore, index, array) {
return !chore.done;
})
});
-
+
let hamster = Hamster.create({
chores: [
{ name: 'cook', done: true },
@@ -39915,68 +39915,68 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
{ name: 'write more unit tests', done: false }
]
});
-
+
hamster.remainingChores; // [{name: 'write more unit tests', done: false}]
```
-
+
You can also use `@each.property` in your dependent key, the callback will
still use the underlying array:
-
+
```javascript
import { set } from '@ember/object';
import { filter } from '@ember/object/computed';
-
+
class Hamster {
constructor(chores) {
set(this, 'chores', chores);
}
-
+
@filter('chores.@each.done', function(chore, index, array) {
return !chore.done;
})
remainingChores;
}
-
+
let hamster = new Hamster([
{ name: 'cook', done: true },
{ name: 'clean', done: true },
{ name: 'write more unit tests', done: false }
]);
hamster.remainingChores; // [{name: 'write more unit tests', done: false}]
-
+
set(hamster.chores[2], 'done', true);
hamster.remainingChores; // []
```
-
+
Finally, you can optionally pass an array of additional dependent keys as the
second parameter to the macro, if your filter function relies on any external
values:
-
+
```javascript
import { filter } from '@ember/object/computed';
-
+
class Hamster {
constructor(chores) {
set(this, 'chores', chores);
}
-
+
doneKey = 'finished';
-
+
@filter('chores', ['doneKey'], function(chore, index, array) {
return !chore[this.doneKey];
})
remainingChores;
}
-
+
let hamster = new Hamster([
{ name: 'cook', finished: true },
{ name: 'clean', finished: true },
{ name: 'write more unit tests', finished: false }
]);
-
+
hamster.remainingChores; // [{name: 'write more unit tests', finished: false}]
```
-
+
@method filter
@for @ember/object/computed
@static
@@ -40004,40 +40004,40 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
}
/**
Filters the array by the property and value.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { filterBy } from '@ember/object/computed';
-
+
class Hamster {
constructor(chores) {
set(this, 'chores', chores);
}
-
+
@filterBy('chores', 'done', false) remainingChores;
}
-
+
let hamster = new Hamster([
{ name: 'cook', done: true },
{ name: 'clean', done: true },
{ name: 'write more unit tests', done: false }
]);
-
+
hamster.remainingChores; // [{ name: 'write more unit tests', done: false }]
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject from '@ember/object';
import { filterBy } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
remainingChores: filterBy('chores', 'done', false)
});
-
+
let hamster = Hamster.create({
chores: [
{ name: 'cook', done: true },
@@ -40045,10 +40045,10 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
{ name: 'write more unit tests', done: false }
]
});
-
+
hamster.remainingChores; // [{ name: 'write more unit tests', done: false }]
```
-
+
@method filterBy
@for @ember/object/computed
@static
@@ -40076,41 +40076,41 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
/**
A computed property which returns a new array with all the unique elements
from one or more dependent arrays.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { uniq } from '@ember/object/computed';
-
+
class Hamster {
constructor(fruits) {
set(this, 'fruits', fruits);
}
-
+
@uniq('fruits') uniqueFruits;
}
-
+
let hamster = new Hamster([
'banana',
'grape',
'kale',
'banana'
]);
-
+
hamster.uniqueFruits; // ['banana', 'grape', 'kale']
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject from '@ember/object';
import { uniq } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
uniqueFruits: uniq('fruits')
});
-
+
let hamster = Hamster.create({
fruits: [
'banana',
@@ -40119,10 +40119,10 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
'banana'
]
});
-
+
hamster.uniqueFruits; // ['banana', 'grape', 'kale']
```
-
+
@method uniq
@for @ember/object/computed
@static
@@ -40156,41 +40156,41 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
/**
A computed property which returns a new array with all the unique elements
from an array, with uniqueness determined by specific key.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { uniqBy } from '@ember/object/computed';
-
+
class Hamster {
constructor(fruits) {
set(this, 'fruits', fruits);
}
-
+
@uniqBy('fruits', 'id') uniqueFruits;
}
-
+
let hamster = new Hamster([
{ id: 1, 'banana' },
{ id: 2, 'grape' },
{ id: 3, 'peach' },
{ id: 1, 'banana' }
]);
-
+
hamster.uniqueFruits; // [ { id: 1, 'banana' }, { id: 2, 'grape' }, { id: 3, 'peach' }]
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject from '@ember/object';
import { uniqBy } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
uniqueFruits: uniqBy('fruits', 'id')
});
-
+
let hamster = Hamster.create({
fruits: [
{ id: 1, 'banana' },
@@ -40199,10 +40199,10 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
{ id: 1, 'banana' }
]
});
-
+
hamster.uniqueFruits; // [ { id: 1, 'banana' }, { id: 2, 'grape' }, { id: 3, 'peach' }]
```
-
+
@method uniqBy
@for @ember/object/computed
@static
@@ -40225,22 +40225,22 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
/**
A computed property which returns a new array with all the unique elements
from one or more dependent arrays.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { union } from '@ember/object/computed';
-
+
class Hamster {
constructor(fruits, vegetables) {
set(this, 'fruits', fruits);
set(this, 'vegetables', vegetables);
}
-
+
@union('fruits', 'vegetables') ediblePlants;
});
-
+
let hamster = new, Hamster(
[
'banana',
@@ -40255,20 +40255,20 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
'lettuce'
]
);
-
+
hamster.uniqueFruits; // ['banana', 'grape', 'kale', 'tomato', 'carrot', 'lettuce']
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject from '@ember/object';
import { union } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
uniqueFruits: union('fruits', 'vegetables')
});
-
+
let hamster = Hamster.create({
fruits: [
'banana',
@@ -40283,10 +40283,10 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
'lettuce'
]
});
-
+
hamster.uniqueFruits; // ['banana', 'grape', 'kale', 'tomato', 'carrot', 'lettuce']
```
-
+
@method union
@for @ember/object/computed
@static
@@ -40301,48 +40301,48 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
/**
A computed property which returns a new array with all the elements
two or more dependent arrays have in common.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { intersect } from '@ember/object/computed';
-
+
class FriendGroups {
constructor(adaFriends, charlesFriends) {
set(this, 'adaFriends', adaFriends);
set(this, 'charlesFriends', charlesFriends);
}
-
+
@intersect('adaFriends', 'charlesFriends') friendsInCommon;
}
-
+
let groups = new FriendGroups(
['Charles Babbage', 'John Hobhouse', 'William King', 'Mary Somerville'],
['William King', 'Mary Somerville', 'Ada Lovelace', 'George Peacock']
);
-
+
groups.friendsInCommon; // ['William King', 'Mary Somerville']
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject from '@ember/object';
import { intersect } from '@ember/object/computed';
-
+
let FriendGroups = EmberObject.extend({
friendsInCommon: intersect('adaFriends', 'charlesFriends')
});
-
+
let groups = FriendGroups.create({
adaFriends: ['Charles Babbage', 'John Hobhouse', 'William King', 'Mary Somerville'],
charlesFriends: ['William King', 'Mary Somerville', 'Ada Lovelace', 'George Peacock']
});
-
+
groups.friendsInCommon; // ['William King', 'Mary Somerville']
```
-
+
@method intersect
@for @ember/object/computed
@static
@@ -40386,22 +40386,22 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
/**
A computed property which returns a new array with all the properties from the
first dependent array that are not in the second dependent array.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { setDiff } from '@ember/object/computed';
-
+
class Hamster {
constructor(likes, fruits) {
set(this, 'likes', likes);
set(this, 'fruits', fruits);
}
-
+
@setDiff('likes', 'fruits') wants;
}
-
+
let hamster = new Hamster(
[
'banana',
@@ -40413,20 +40413,20 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
'kale',
]
);
-
+
hamster.wants; // ['banana']
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject from '@ember/object';
import { setDiff } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
wants: setDiff('likes', 'fruits')
});
-
+
let hamster = Hamster.create({
likes: [
'banana',
@@ -40438,10 +40438,10 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
'kale',
]
});
-
+
hamster.wants; // ['banana']
```
-
+
@method setDiff
@for @ember/object/computed
@static
@@ -40475,45 +40475,45 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
/**
A computed property that returns the array of values for the provided
dependent properties.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { collect } from '@ember/object/computed';
-
+
class Hamster {
@collect('hat', 'shirt') clothes;
}
-
+
let hamster = new Hamster();
-
+
hamster.clothes; // [null, null]
-
+
set(hamster, 'hat', 'Camp Hat');
set(hamster, 'shirt', 'Camp Shirt');
hamster.clothes; // ['Camp Hat', 'Camp Shirt']
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject, { set } from '@ember/object';
import { collect } from '@ember/object/computed';
-
+
let Hamster = EmberObject.extend({
clothes: collect('hat', 'shirt')
});
-
+
let hamster = Hamster.create();
-
+
hamster.clothes; // [null, null]
-
+
set(hamster, 'hat', 'Camp Hat');
set(hamster, 'shirt', 'Camp Shirt');
hamster.clothes; // ['Camp Hat', 'Camp Shirt']
```
-
+
@method collect
@for @ember/object/computed
@static
@@ -40538,40 +40538,40 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
A computed property which returns a new array with all the properties from the
first dependent array sorted based on a property or sort function. The sort
macro can be used in two different ways:
-
+
1. By providing a sort callback function
2. By providing an array of keys to sort the array
-
+
In the first form, the callback method you provide should have the following
signature:
-
+
```javascript
function sortCallback(itemA, itemB);
```
-
+
- `itemA` the first item to compare.
- `itemB` the second item to compare.
-
+
This function should return negative number (e.g. `-1`) when `itemA` should
come before `itemB`. It should return positive number (e.g. `1`) when `itemA`
should come after `itemB`. If the `itemA` and `itemB` are equal this function
should return `0`.
-
+
Therefore, if this function is comparing some numeric values, simple `itemA -
itemB` or `itemA.get( 'foo' ) - itemB.get( 'foo' )` can be used instead of
series of `if`.
-
+
Example:
-
+
```javascript
import { set } from '@ember/object';
import { sort } from '@ember/object/computed';
-
+
class ToDoList {
constructor(todos) {
set(this, 'todos', todos);
}
-
+
// using a custom sort function
@sort('todos', function(a, b){
if (a.priority > b.priority) {
@@ -40579,27 +40579,27 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
} else if (a.priority < b.priority) {
return -1;
}
-
+
return 0;
})
priorityTodos;
}
-
+
let todoList = new ToDoList([
{ name: 'Unit Test', priority: 2 },
{ name: 'Documentation', priority: 3 },
{ name: 'Release', priority: 1 }
]);
-
+
todoList.priorityTodos; // [{ name:'Release', priority:1 }, { name:'Unit Test', priority:2 }, { name:'Documentation', priority:3 }]
```
-
+
Classic Class Example:
-
+
```javascript
import EmberObject from '@ember/object';
import { sort } from '@ember/object/computed';
-
+
let ToDoList = EmberObject.extend({
// using a custom sort function
priorityTodos: sort('todos', function(a, b){
@@ -40608,11 +40608,11 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
} else if (a.priority < b.priority) {
return -1;
}
-
+
return 0;
})
});
-
+
let todoList = ToDoList.create({
todos: [
{ name: 'Unit Test', priority: 2 },
@@ -40620,25 +40620,25 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
{ name: 'Release', priority: 1 }
]
});
-
+
todoList.priorityTodos; // [{ name:'Release', priority:1 }, { name:'Unit Test', priority:2 }, { name:'Documentation', priority:3 }]
```
-
+
You can also optionally pass an array of additional dependent keys as the
second parameter, if your sort function is dependent on additional values that
could changes:
-
+
```js
import EmberObject, { set } from '@ember/object';
import { sort } from '@ember/object/computed';
-
+
class ToDoList {
sortKey = 'priority';
-
+
constructor(todos) {
set(this, 'todos', todos);
}
-
+
// using a custom sort function
@sort('todos', ['sortKey'], function(a, b){
if (a[this.sortKey] > b[this.sortKey]) {
@@ -40646,52 +40646,52 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
} else if (a[this.sortKey] < b[this.sortKey]) {
return -1;
}
-
+
return 0;
})
sortedTodos;
});
-
+
let todoList = new ToDoList([
{ name: 'Unit Test', priority: 2 },
{ name: 'Documentation', priority: 3 },
{ name: 'Release', priority: 1 }
]);
-
+
todoList.priorityTodos; // [{ name:'Release', priority:1 }, { name:'Unit Test', priority:2 }, { name:'Documentation', priority:3 }]
```
-
+
In the second form, you should provide the key of the array of sort values as
the second parameter:
-
+
```javascript
import { set } from '@ember/object';
import { sort } from '@ember/object/computed';
-
+
class ToDoList {
constructor(todos) {
set(this, 'todos', todos);
}
-
+
// using standard ascending sort
todosSorting = ['name'];
@sort('todos', 'todosSorting') sortedTodos;
-
+
// using descending sort
todosSortingDesc = ['name:desc'];
@sort('todos', 'todosSortingDesc') sortedTodosDesc;
}
-
+
let todoList = new ToDoList([
{ name: 'Unit Test', priority: 2 },
{ name: 'Documentation', priority: 3 },
{ name: 'Release', priority: 1 }
]);
-
+
todoList.sortedTodos; // [{ name:'Documentation', priority:3 }, { name:'Release', priority:1 }, { name:'Unit Test', priority:2 }]
todoList.sortedTodosDesc; // [{ name:'Unit Test', priority:2 }, { name:'Release', priority:1 }, { name:'Documentation', priority:3 }]
```
-
+
@method sort
@for @ember/object/computed
@static
@@ -40833,17 +40833,17 @@ define("@ember/polyfills/lib/assign", ["exports"], function (_exports) {
/**
Copy properties from a source object to a target object. Source arguments remain unchanged.
-
+
```javascript
import { assign } from '@ember/polyfills';
-
+
var a = { first: 'Yehuda' };
var b = { last: 'Katz' };
var c = { company: 'Other Company' };
var d = { company: 'Tilde Inc.' };
assign(a, b, c, d); // a === { first: 'Yehuda', last: 'Katz', company: 'Tilde Inc.' };
```
-
+
@method assign
@for @ember/polyfills
@param {Object} target The object to assign into
@@ -40893,16 +40893,16 @@ define("@ember/polyfills/lib/merge", ["exports", "@ember/debug"], function (_exp
/**
Merge the contents of two objects together into the first object.
-
+
```javascript
import { merge } from '@ember/polyfills';
-
+
merge({ first: 'Tom' }, { last: 'Dale' }); // { first: 'Tom', last: 'Dale' }
var a = { first: 'Yehuda' };
var b = { last: 'Katz' };
merge(a, b); // a == { first: 'Yehuda', last: 'Katz' }, b == { last: 'Katz' }
```
-
+
@method merge
@static
@for @ember/polyfills
@@ -41017,7 +41017,7 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
are flushed at the end of the RunLoop. You can define your own queues by
simply adding the queue name to this array. Normally you should not need
to inspect or modify this property.
-
+
@property queues
@type Array
@default ['actions', 'destroy']
@@ -41051,15 +41051,15 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
Runs the passed target and method inside of a RunLoop, ensuring any
deferred actions including bindings and views updates are flushed at the
end.
-
+
Normally you should not need to invoke this method yourself. However if
you are implementing raw event handlers when interfacing with other
libraries or plugins, you should probably wrap all of your code inside this
call.
-
+
```javascript
import { run } from '@ember/runloop';
-
+
run(function() {
// code to be executed within a RunLoop
});
@@ -41088,34 +41088,34 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
If no run-loop is present, it creates a new one. If a run loop is
present it will queue itself to run on the existing run-loops action
queue.
-
+
Please note: This is not for normal usage, and should be used sparingly.
-
+
If invoked when not within a run loop:
-
+
```javascript
import { join } from '@ember/runloop';
-
+
join(function() {
// creates a new run-loop
});
```
-
+
Alternatively, if called within an existing run loop:
-
+
```javascript
import { run, join } from '@ember/runloop';
-
+
run(function() {
// creates a new run-loop
-
+
join(function() {
// joins with the existing run-loop, and queues for invocation on
// the existing run-loops action queue.
});
});
```
-
+
@method join
@static
@for @ember/runloop
@@ -41140,22 +41140,22 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
adding the execution of that function to the Ember run loop. This ability
makes this method a great way to asynchronously integrate third-party libraries
into your Ember application.
-
+
`bind` takes two main arguments, the desired context and the function to
invoke in that context. Any additional arguments will be supplied as arguments
to the function that is passed in.
-
+
Let's use the creation of a TinyMCE component as an example. Currently,
TinyMCE provides a setup configuration option we can use to do some processing
after the TinyMCE instance is initialized but before it is actually rendered.
We can use that setup option to do some additional setup for our component.
The component itself could look something like the following:
-
+
```app/components/rich-text-editor.js
import Component from '@ember/component';
import { on } from '@ember/object/evented';
import { bind } from '@ember/runloop';
-
+
export default Component.extend({
initializeTinyMCE: on('didInsertElement', function() {
tinymce.init({
@@ -41163,28 +41163,28 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
setup: bind(this, this.setupEditor)
});
}),
-
+
didInsertElement() {
tinymce.init({
selector: '#' + this.$().prop('id'),
setup: bind(this, this.setupEditor)
});
}
-
+
setupEditor(editor) {
this.set('editor', editor);
-
+
editor.on('change', function() {
console.log('content changed!');
});
}
});
```
-
+
In this example, we use `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
@static
@for @ember/runloop
@@ -41234,15 +41234,15 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
Begins a new RunLoop. Any deferred actions invoked after the begin will
be buffered until you invoke a matching call to `end()`. This is
a lower-level way to use a RunLoop instead of using `run()`.
-
+
```javascript
import { begin, end } from '@ember/runloop';
-
+
begin();
// code to be executed within a RunLoop
end();
```
-
+
@method begin
@static
@for @ember/runloop
@@ -41260,15 +41260,15 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
Ends a RunLoop. This must be called sometime after you call
`begin()` to flush any deferred actions. This is a lower-level way
to use a RunLoop instead of using `run()`.
-
+
```javascript
import { begin, end } from '@ember/runloop';
-
+
begin();
// code to be executed within a RunLoop
end();
```
-
+
@method end
@static
@for @ember/runloop
@@ -41285,30 +41285,30 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
queue to be executed at the end of the RunLoop. If you have not already
started a RunLoop when calling this method one will be started for you
automatically.
-
+
At the end of a RunLoop, any methods scheduled in this way will be invoked.
Methods will be invoked in an order matching the named queues defined in
the `queues` property.
-
+
```javascript
import { schedule } from '@ember/runloop';
-
+
schedule('afterRender', this, function() {
// this will be executed in the 'afterRender' queue
console.log('scheduled on afterRender queue');
});
-
+
schedule('actions', this, function() {
// this will be executed in the 'actions' queue
console.log('scheduled on actions queue');
});
-
+
// Note the functions will be run in order based on the run queues order.
// Output would be:
// scheduled on actions queue
// scheduled on afterRender queue
```
-
+
@method schedule
@static
@for @ember/runloop
@@ -41342,20 +41342,20 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
Invokes the passed target/method and optional arguments after a specified
period of time. The last parameter of this method must always be a number
of milliseconds.
-
+
You should use this method whenever you need to run some action after a
period of time instead of using `setTimeout()`. This method will ensure that
items that expire during the same script execution cycle all execute
together, which is often more efficient than using a real setTimeout.
-
+
```javascript
import { later } from '@ember/runloop';
-
+
later(myContext, function() {
// code here will execute within a RunLoop in about 500ms with this == myContext
}, 500);
```
-
+
@method later
@static
@for @ember/runloop
@@ -41378,7 +41378,7 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
/**
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
@@ -41400,62 +41400,62 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
Schedules a function to run one time in a given queue of the current RunLoop.
Calling this method with the same queue/target/method combination will have
no effect (past the initial call).
-
+
Note that although you can pass optional arguments these will not be
considered when looking for duplicates. New arguments will replace previous
calls.
-
+
```javascript
import { run, scheduleOnce } from '@ember/runloop';
-
+
function sayHi() {
console.log('hi');
}
-
+
run(function() {
scheduleOnce('afterRender', myContext, sayHi);
scheduleOnce('afterRender', myContext, sayHi);
// sayHi will only be executed once, in the afterRender queue of the RunLoop
});
```
-
+
Also note that for `scheduleOnce` to prevent additional calls, you need to
pass the same function instance. The following case works as expected:
-
+
```javascript
function log() {
console.log('Logging only once');
}
-
+
function scheduleIt() {
scheduleOnce('actions', myContext, log);
}
-
+
scheduleIt();
scheduleIt();
```
-
+
But this other case will schedule the function multiple times:
-
+
```javascript
import { scheduleOnce } from '@ember/runloop';
-
+
function scheduleIt() {
scheduleOnce('actions', myContext, function() {
console.log('Closure');
});
}
-
+
scheduleIt();
scheduleIt();
-
+
// "Closure" will print twice, even though we're using `scheduleOnce`,
// because the function we pass to it won't match the
// previously scheduled operation.
```
-
+
Available queues, and their order, can be found at `queues`
-
+
@method scheduleOnce
@static
@for @ember/runloop
@@ -41479,40 +41479,40 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
Schedules an item to run from within a separate run loop, after
control has been returned to the system. This is equivalent to calling
`later` with a wait time of 1ms.
-
+
```javascript
import { next } from '@ember/runloop';
-
+
next(myContext, function() {
// code to be executed in the next run loop,
// which will be scheduled after the current one
});
```
-
+
Multiple operations scheduled with `next` will coalesce
into the same later run loop, along with any other operations
scheduled by `later` that expire right around the same
time that `next` operations will fire.
-
+
Note that there are often alternatives to using `next`.
For instance, if you'd like to schedule an operation to happen
after all DOM element operations have completed within the current
run loop, you can make use of the `afterRender` run loop queue (added
by the `ember-views` package, along with the preceding `render` queue
where all the DOM element operations happen).
-
+
Example:
-
+
```app/components/my-component.js
import Component from '@ember/component';
import { scheduleOnce } from '@ember/runloop';
-
+
export Component.extend({
didInsertElement() {
this._super(...arguments);
scheduleOnce('afterRender', this, 'processChildElements');
},
-
+
processChildElements() {
// ... do something with component's child component
// elements after they've finished rendering, which
@@ -41522,18 +41522,18 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
}
});
```
-
+
One benefit of the above approach compared to using `next` is
that you will be able to perform DOM/CSS operations before unprocessed
elements are rendered to the screen, which may prevent flickering or
other artifacts caused by delaying processing until after rendering.
-
+
The other major benefit to the above approach is that `next`
introduces an element of non-determinism, which can make things much
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 `next`.
-
+
@method next
@static
@for @ember/runloop
@@ -41555,7 +41555,7 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
Cancels a scheduled item. Must be a value returned by `later()`,
`once()`, `scheduleOnce()`, `next()`, `debounce()`, or
`throttle()`.
-
+
```javascript
import {
next,
@@ -41566,51 +41566,51 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
throttle,
debounce
} from '@ember/runloop';
-
+
let runNext = next(myContext, function() {
// will not be executed
});
-
+
cancel(runNext);
-
+
let runLater = later(myContext, function() {
// will not be executed
}, 500);
-
+
cancel(runLater);
-
+
let runScheduleOnce = scheduleOnce('afterRender', myContext, function() {
// will not be executed
});
-
+
cancel(runScheduleOnce);
-
+
let runOnce = once(myContext, function() {
// will not be executed
});
-
+
cancel(runOnce);
-
+
let throttle = throttle(myContext, function() {
// will not be executed
}, 1, false);
-
+
cancel(throttle);
-
+
let debounce = debounce(myContext, function() {
// will not be executed
}, 1);
-
+
cancel(debounce);
-
+
let debounceImmediate = debounce(myContext, function() {
// will be executed since we passed in true (immediate)
}, 100, true);
-
+
// the 100ms delay until this method can be called again will be canceled
cancel(debounceImmediate);
```
-
+
@method cancel
@static
@for @ember/runloop
@@ -41628,61 +41628,61 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
with no additional debounce calls. If `debounce` is called again before
the specified time has elapsed, the timer is reset and the entire period
must pass again before the target method is called.
-
+
This method should be used when an event may be called multiple times
but the action should only be called once when the event is done firing.
A common example is for scroll events where you only want updates to
happen once scrolling has ceased.
-
+
```javascript
import { debounce } from '@ember/runloop';
-
+
function whoRan() {
console.log(this.name + ' ran.');
}
-
+
let myContext = { name: 'debounce' };
-
+
debounce(myContext, whoRan, 150);
-
+
// less than 150ms passes
debounce(myContext, whoRan, 150);
-
+
// 150ms passes
// whoRan is invoked with context myContext
// console logs 'debounce ran.' one time.
```
-
+
Immediate allows you to run the function immediately, but debounce
other calls for this function until the wait time has elapsed. If
`debounce` is called again before the specified time has elapsed,
the timer is reset and the entire period must pass again before
the method can be called again.
-
+
```javascript
import { debounce } from '@ember/runloop';
-
+
function whoRan() {
console.log(this.name + ' ran.');
}
-
+
let myContext = { name: 'debounce' };
-
+
debounce(myContext, whoRan, 150, true);
-
+
// console logs 'debounce ran.' one time immediately.
// 100ms passes
debounce(myContext, whoRan, 150, true);
-
+
// 150ms passes and nothing else is logged to the console and
// the debouncee is no longer being watched
debounce(myContext, whoRan, 150, true);
-
+
// console logs 'debounce ran.' one time immediately.
// 150ms passes and nothing else is logged to the console and
// the debouncee is no longer being watched
```
-
+
@method debounce
@static
@for @ember/runloop
@@ -41705,32 +41705,32 @@ define("@ember/runloop/index", ["exports", "@ember/debug", "@ember/-internals/er
/**
Ensure that the target method is never called more frequently than
the specified spacing period. The target method is called immediately.
-
+
```javascript
import { throttle } from '@ember/runloop';
-
+
function whoRan() {
console.log(this.name + ' ran.');
}
-
+
let myContext = { name: 'throttle' };
-
+
throttle(myContext, whoRan, 150);
// whoRan is invoked with context myContext
// console logs 'throttle ran.'
-
+
// 50ms passes
throttle(myContext, whoRan, 150);
-
+
// 50ms passes
throttle(myContext, whoRan, 150);
-
+
// 150ms passes
throttle(myContext, whoRan, 150);
// whoRan is invoked with context myContext
// console logs 'throttle ran.'
```
-
+
@method throttle
@static
@for @ember/runloop
@@ -41768,41 +41768,41 @@ define("@ember/service/index", ["exports", "@ember/-internals/runtime", "@ember/
/**
Creates a property that lazily looks up a service in the container. There are
no restrictions as to what objects a service can be injected into.
-
+
Example:
-
+
```app/routes/application.js
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
-
+
export default class ApplicationRoute extends Route {
@service('auth') authManager;
-
+
model() {
return this.authManager.findCurrentUser();
}
}
```
-
+
Classic Class Example:
-
+
```app/routes/application.js
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
-
+
export default Route.extend({
authManager: service('auth'),
-
+
model() {
return this.get('authManager').findCurrentUser();
}
});
```
-
+
This example will create an `authManager` property on the application route
that looks up the `auth` service in the container, making it easily accessible
in the `model` hook.
-
+
@method inject
@static
@since 1.10.0
@@ -41900,7 +41900,7 @@ define("@ember/string/index", ["exports", "@ember/string/lib/string_registry", "
Defines string helper methods including string formatting and localization.
Unless `EmberENV.EXTEND_PROTOTYPES.String` is `false` these methods will also be
added to the `String.prototype` as well.
-
+
@class String
@public
*/
@@ -41918,23 +41918,23 @@ define("@ember/string/index", ["exports", "@ember/string/lib/string_registry", "
/**
Formats the passed string, but first looks up the string in the localized
strings hash. This is a convenient way to localize text.
-
+
Note that it is traditional but not required to prefix localized string
keys with an underscore or other character so you can easily identify
localized strings.
-
+
```javascript
import { loc } from '@ember/string';
-
+
Ember.STRINGS = {
'_Hello World': 'Bonjour le monde',
'_Hello %@ %@': 'Bonjour %@ %@'
};
-
+
loc("_Hello World"); // 'Bonjour le monde';
loc("_Hello %@ %@", ["John", "Smith"]); // "Bonjour John Smith";
```
-
+
@method loc
@param {String} str The string to format
@param {Array} formats Optional array of parameters to interpolate into string.
@@ -41955,19 +41955,19 @@ define("@ember/string/index", ["exports", "@ember/string/lib/string_registry", "
Splits a string into separate units separated by spaces, eliminating any
empty strings in the process. This is a convenience method for split that
is mostly useful when applied to the `String.prototype`.
-
+
```javascript
import { w } from '@ember/string';
-
+
w("alpha beta gamma").forEach(function(key) {
console.log(key);
});
-
+
// > alpha
// > beta
// > gamma
```
-
+
@method w
@param {String} str The string to split
@return {Array} array containing the split strings
@@ -41980,16 +41980,16 @@ define("@ember/string/index", ["exports", "@ember/string/lib/string_registry", "
}
/**
Converts a camelized string into all lower case separated by underscores.
-
+
```javascript
import { decamelize } from '@ember/string';
-
+
decamelize('innerHTML'); // 'inner_html'
decamelize('action_name'); // 'action_name'
decamelize('css-class-name'); // 'css-class-name'
decamelize('my favorite items'); // 'my favorite items'
```
-
+
@method decamelize
@param {String} str The string to decamelize.
@return {String} the decamelized string.
@@ -42002,17 +42002,17 @@ define("@ember/string/index", ["exports", "@ember/string/lib/string_registry", "
}
/**
Replaces underscores, spaces, or camelCase with dashes.
-
+
```javascript
import { dasherize } from '@ember/string';
-
+
dasherize('innerHTML'); // 'inner-html'
dasherize('action_name'); // 'action-name'
dasherize('css-class-name'); // 'css-class-name'
dasherize('my favorite items'); // 'my-favorite-items'
dasherize('privateDocs/ownerInvoice'; // 'private-docs/owner-invoice'
```
-
+
@method dasherize
@param {String} str The string to dasherize.
@return {String} the dasherized string.
@@ -42025,10 +42025,10 @@ define("@ember/string/index", ["exports", "@ember/string/lib/string_registry", "
}
/**
Returns the lowerCamelCase form of a string.
-
+
```javascript
import { camelize } from '@ember/string';
-
+
camelize('innerHTML'); // 'innerHTML'
camelize('action_name'); // 'actionName'
camelize('css-class-name'); // 'cssClassName'
@@ -42036,7 +42036,7 @@ define("@ember/string/index", ["exports", "@ember/string/lib/string_registry", "
camelize('My Favorite Items'); // 'myFavoriteItems'
camelize('private-docs/owner-invoice'); // 'privateDocs/ownerInvoice'
```
-
+
@method camelize
@param {String} str The string to camelize.
@return {String} the camelized string.
@@ -42049,17 +42049,17 @@ define("@ember/string/index", ["exports", "@ember/string/lib/string_registry", "
}
/**
Returns the UpperCamelCase form of a string.
-
+
```javascript
import { classify } from '@ember/string';
-
+
classify('innerHTML'); // 'InnerHTML'
classify('action_name'); // 'ActionName'
classify('css-class-name'); // 'CssClassName'
classify('my favorite items'); // 'MyFavoriteItems'
classify('private-docs/owner-invoice'); // 'PrivateDocs/OwnerInvoice'
```
-
+
@method classify
@param {String} str the string to classify
@return {String} the classified string
@@ -42073,17 +42073,17 @@ define("@ember/string/index", ["exports", "@ember/string/lib/string_registry", "
/**
More general than decamelize. Returns the lower\_case\_and\_underscored
form of a string.
-
+
```javascript
import { underscore } from '@ember/string';
-
+
underscore('innerHTML'); // 'inner_html'
underscore('action_name'); // 'action_name'
underscore('css-class-name'); // 'css_class_name'
underscore('my favorite items'); // 'my_favorite_items'
underscore('privateDocs/ownerInvoice'); // 'private_docs/owner_invoice'
```
-
+
@method underscore
@param {String} str The string to underscore.
@return {String} the underscored string.
@@ -42096,17 +42096,17 @@ define("@ember/string/index", ["exports", "@ember/string/lib/string_registry", "
}
/**
Returns the Capitalized form of a string
-
+
```javascript
import { capitalize } from '@ember/string';
-
+
capitalize('innerHTML') // 'InnerHTML'
capitalize('action_name') // 'Action_name'
capitalize('css-class-name') // 'Css-class-name'
capitalize('my favorite items') // 'My favorite items'
capitalize('privateDocs/ownerInvoice'); // 'PrivateDocs/ownerInvoice'
```
-
+
@method capitalize
@param {String} str The string to capitalize.
@return {String} The capitalized string.
@@ -51815,7 +51815,7 @@ define("@glimmer/runtime", ["exports", "@glimmer/util", "@glimmer/reference", "@
}
/*
The calling convention is:
-
+
* 0-N block arguments at the bottom
* 0-N positional arguments next (left-to-right)
* 0-N named arguments next
@@ -58145,7 +58145,7 @@ define("ember-babel", ["exports"], function (_exports) {
Differs from default implementation by checking for _any_ `Reflect.construct`
(the default implementation tries to ensure that `Reflect.construct` is truly
the native one).
-
+
Original source: https://github.com/babel/babel/blob/v7.9.2/packages/babel-helpers/src/helpers.js#L738-L757
*/
@@ -58269,7 +58269,7 @@ define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runt
/**
The primary purpose of this class is to create hooks that can be implemented
by an adapter for various test frameworks.
-
+
@class TestAdapter
@public
*/
@@ -58331,7 +58331,7 @@ define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils"
/**
This class implements the methods defined by TestAdapter for the
QUnit testing framework.
-
+
@class QUnitAdapter
@namespace Ember.Test
@extends TestAdapter
@@ -58755,15 +58755,15 @@ define("ember-testing/lib/helpers/click", ["exports", "ember-testing/lib/events"
/**
Clicks an element and triggers any actions triggered by the element's `click`
event.
-
+
Example:
-
+
```javascript
click('.some-jQuery-selector').then(function() {
// assert something
});
```
-
+
@method click
@param {String} selector jQuery selector for finding element on the DOM
@param {Object} context A DOM Element, Document, or jQuery to use as context
@@ -58794,17 +58794,17 @@ define("ember-testing/lib/helpers/current_path", ["exports", "@ember/-internals/
/**
Returns the current path.
-
+
Example:
-
+
```javascript
function validateURL() {
equal(currentPath(), 'some.path.index', "correct path was transitioned into.");
}
-
+
click('#some-link-id').then(validateURL);
```
-
+
@method currentPath
@return {Object} The currently active path.
@since 1.5.0
@@ -58830,16 +58830,16 @@ define("ember-testing/lib/helpers/current_route_name", ["exports", "@ember/-inte
/**
Returns the currently active route name.
-
+
Example:
-
+
```javascript
function validateRouteName() {
equal(currentRouteName(), 'some.path', "correct route was transitioned into.");
}
visit('/some/path').then(validateRouteName)
```
-
+
@method currentRouteName
@return {Object} The name of the currently active route.
@since 1.5.0
@@ -58865,17 +58865,17 @@ define("ember-testing/lib/helpers/current_url", ["exports", "@ember/-internals/m
/**
Returns the current URL.
-
+
Example:
-
+
```javascript
function validateURL() {
equal(currentURL(), '/some/path', "correct URL was transitioned into.");
}
-
+
click('#some-link-id').then(validateURL);
```
-
+
@method currentURL
@return {Object} The currently active URL.
@since 1.5.0
@@ -58901,15 +58901,15 @@ define("ember-testing/lib/helpers/fill_in", ["exports", "ember-testing/lib/event
/**
Fills in an input element with some text.
-
+
Example:
-
+
```javascript
fillIn('#email', 'you@example.com').then(function() {
// assert something
});
```
-
+
@method fillIn
@param {String} selector jQuery selector finding an input element on the DOM
to fill text with
@@ -58956,19 +58956,19 @@ define("ember-testing/lib/helpers/find", ["exports", "@ember/-internals/metal",
/**
Finds an element in the context of the app's container element. A simple alias
for `app.$(selector)`.
-
+
Example:
-
+
```javascript
var $el = find('.my-selector');
```
-
+
With the `context` param:
-
+
```javascript
var $el = find('.my-selector', '.parent-element-class');
```
-
+
@method find
@param {String} selector jQuery selector for element lookup
@param {String} [context] (optional) jQuery selector that will limit the selector
@@ -59001,19 +59001,19 @@ define("ember-testing/lib/helpers/find_with_assert", ["exports"], function (_exp
/**
Like `find`, but throws an error if the element selector returns no results.
-
+
Example:
-
+
```javascript
var $el = findWithAssert('.doesnt-exist'); // throws error
```
-
+
With the `context` param:
-
+
```javascript
var $el = findWithAssert('.selector-id', '.parent-element-class'); // assert will pass
```
-
+
@method findWithAssert
@param {String} selector jQuery selector string for finding an element within
the DOM
@@ -59094,7 +59094,7 @@ define("ember-testing/lib/helpers/pause_test", ["exports", "@ember/-internals/ru
var resume;
/**
Resumes a test paused by `pauseTest`.
-
+
@method resumeTest
@return {void}
@public
@@ -59109,34 +59109,34 @@ define("ember-testing/lib/helpers/pause_test", ["exports", "@ember/-internals/ru
Pauses the current test - this is useful for debugging while testing or for test-driving.
It allows you to inspect the state of your application at any point.
Example (The test will pause before clicking the button):
-
+
```javascript
visit('/')
return pauseTest();
click('.btn');
```
-
+
You may want to turn off the timeout before pausing.
-
+
qunit (timeout available to use as of 2.4.0):
-
+
```
visit('/');
assert.timeout(0);
return pauseTest();
click('.btn');
```
-
+
mocha (timeout happens automatically as of ember-mocha v0.14.0):
-
+
```
visit('/');
this.timeout(0);
return pauseTest();
click('.btn');
```
-
-
+
+
@since 1.9.0
@method pauseTest
@return {Object} A promise that will never resolve
@@ -59232,15 +59232,15 @@ define("ember-testing/lib/helpers/visit", ["exports", "@ember/runloop"], functio
Loads a route, sets up any controllers, and renders any templates associated
with the route as though a real user had triggered the route change while
using your app.
-
+
Example:
-
+
```javascript
visit('posts/index').then(function() {
// assert something
});
```
-
+
@method visit
@param {String} url the name of the route
@return {RSVP.Promise}
@@ -59284,19 +59284,19 @@ define("ember-testing/lib/helpers/wait", ["exports", "ember-testing/lib/test/wai
/**
Causes the run loop to process any pending events. This is used to ensure that
any async operations from other helpers (or your assertions) have been processed.
-
+
This is most often used as the return value for the helper functions (see 'click',
'fillIn','visit',etc). However, there is a method to register a test helper which
utilizes this method without the need to actually call `wait()` in your helpers.
-
+
The `wait` helper is built into `registerAsyncHelper` by default. You will not need
to `return app.testHelpers.wait();` - the wait behavior is provided for you.
-
+
Example:
-
+
```javascript
import { registerAsyncHelper } from '@ember/test';
-
+
registerAsyncHelper('loginUser', function(app, username, password) {
visit('secured/path/here')
.fillIn('#username', username)
@@ -59304,7 +59304,7 @@ define("ember-testing/lib/helpers/wait", ["exports", "ember-testing/lib/test/wai
.click('.submit');
});
```
-
+
@method wait
@param {Object} value The value to be returned.
@return {RSVP.Promise} Promise that resolves to the passed value.
@@ -59378,10 +59378,10 @@ define("ember-testing/lib/setup_for_testing", ["exports", "@ember/debug", "@embe
/**
Sets Ember up for testing. This is useful to perform
basic setup steps in order to unit test.
-
+
Use `App.setupForTesting` to perform integration tests (full
application testing).
-
+
@method setupForTesting
@namespace Ember
@since 1.5.0
@@ -59415,7 +59415,7 @@ define("ember-testing/lib/support", ["@ember/debug", "@ember/-internals/views",
This method creates a checkbox and triggers the click event to fire the
passed in handler. It is used to correct for a bug in older versions
of jQuery (e.g 1.8.3).
-
+
@private
@method testCheckboxClick
*/
@@ -59475,12 +59475,12 @@ define("ember-testing/lib/test", ["exports", "ember-testing/lib/test/helpers", "
/**
This is a container for an assortment of testing related functionality:
-
+
* Choose your default test adapter (for your framework of choice).
* Register/Unregister additional test helpers.
* Setup callbacks to be fired when the test helpers are injected into
your application.
-
+
@class Test
@namespace Ember
@public
@@ -59507,17 +59507,17 @@ define("ember-testing/lib/test", ["exports", "ember-testing/lib/test/helpers", "
/**
Used to allow ember-testing to communicate with a specific testing
framework.
-
+
You can manually set it before calling `App.setupForTesting()`.
-
+
Example:
-
+
```javascript
Ember.Test.adapter = MyCustomAdapter.create()
```
-
+
If you do not set it, ember-testing will default to `Ember.Test.QUnitAdapter`.
-
+
@public
@for Ember.Test
@property adapter
@@ -59593,32 +59593,32 @@ define("ember-testing/lib/test/helpers", ["exports", "ember-testing/lib/test/pro
/**
`registerHelper` is used to register a test helper that will be injected
when `App.injectTestHelpers` is called.
-
+
The helper method will always be called with the current Application as
the first parameter.
-
+
For example:
-
+
```javascript
import { registerHelper } from '@ember/test';
import { run } from '@ember/runloop';
-
+
registerHelper('boot', function(app) {
run(app, app.advanceReadiness);
});
```
-
+
This helper can later be called without arguments because it will be
called with `app` as the first parameter.
-
+
```javascript
import Application from '@ember/application';
-
+
App = Application.create();
App.injectTestHelpers();
boot();
```
-
+
@public
@for @ember/test
@static
@@ -59641,42 +59641,42 @@ define("ember-testing/lib/test/helpers", ["exports", "ember-testing/lib/test/pro
/**
`registerAsyncHelper` is used to register an async test helper that will be injected
when `App.injectTestHelpers` is called.
-
+
The helper method will always be called with the current Application as
the first parameter.
-
+
For example:
-
+
```javascript
import { registerAsyncHelper } from '@ember/test';
import { run } from '@ember/runloop';
-
+
registerAsyncHelper('boot', function(app) {
run(app, app.advanceReadiness);
});
```
-
+
The advantage of an async helper is that it will not run
until the last async helper has completed. All async helpers
after it will wait for it complete before running.
-
-
+
+
For example:
-
+
```javascript
import { registerAsyncHelper } from '@ember/test';
-
+
registerAsyncHelper('deletePost', function(app, postId) {
click('.delete-' + postId);
});
-
+
// ... in your test
visit('/post/2');
deletePost(2);
visit('/post/3');
deletePost(3);
```
-
+
@public
@for @ember/test
@method registerAsyncHelper
@@ -59696,15 +59696,15 @@ define("ember-testing/lib/test/helpers", ["exports", "ember-testing/lib/test/pro
}
/**
Remove a previously added helper method.
-
+
Example:
-
+
```javascript
import { unregisterHelper } from '@ember/test';
-
+
unregisterHelper('wait');
```
-
+
@public
@method unregisterHelper
@static
@@ -59731,25 +59731,25 @@ define("ember-testing/lib/test/on_inject_helpers", ["exports"], function (_expor
/**
Used to register callbacks to be fired whenever `App.injectTestHelpers`
is called.
-
+
The callback will receive the current application as an argument.
-
+
Example:
-
+
```javascript
import $ from 'jquery';
-
+
Ember.Test.onInjectHelpers(function() {
$(document).ajaxSend(function() {
Test.pendingRequests++;
});
-
+
$(document).ajaxComplete(function() {
Test.pendingRequests--;
});
});
```
-
+
@public
@for Ember.Test
@method onInjectHelpers
@@ -59831,9 +59831,9 @@ define("ember-testing/lib/test/promise", ["exports", "@ember/-internals/runtime"
This returns a thenable tailored for testing. It catches failed
`onSuccess` callbacks and invokes the `Ember.Test.adapter.exception`
callback in the last chained then.
-
+
This method should be returned by async helpers such as `wait`.
-
+
@public
@for Ember.Test
@method promise
@@ -59852,7 +59852,7 @@ define("ember-testing/lib/test/promise", ["exports", "@ember/-internals/runtime"
Replacement for `Ember.RSVP.resolve`
The only difference is this uses
an instance of `Ember.Test.Promise`
-
+
@public
@for Ember.Test
@method resolve
@@ -59929,27 +59929,27 @@ define("ember-testing/lib/test/waiters", ["exports"], function (_exports) {
after each async helper (i.e. `click`, `andThen`, `visit`, etc) has executed,
until the returning result is truthy. After the waiters finish, the next async helper
is executed and the process repeats.
-
+
For example:
-
+
```javascript
import { registerWaiter } from '@ember/test';
-
+
registerWaiter(function() {
return myPendingTransactions() === 0;
});
```
The `context` argument allows you to optionally specify the `this`
with which your callback will be invoked.
-
+
For example:
-
+
```javascript
import { registerWaiter } from '@ember/test';
-
+
registerWaiter(MyDB, MyDB.hasPendingTransactions);
```
-
+
@public
@for @ember/test
@static
@@ -59975,7 +59975,7 @@ define("ember-testing/lib/test/waiters", ["exports"], function (_exports) {
/**
`unregisterWaiter` is used to unregister a callback that was
registered with `registerWaiter`.
-
+
@public
@for @ember/test
@static
@@ -60009,10 +60009,10 @@ define("ember-testing/lib/test/waiters", ["exports"], function (_exports) {
Iterates through each registered test waiter, and invokes
its callback. If any waiter returns false, this method will return
true indicating that the waiters have not settled yet.
-
+
This is generally used internally from the acceptance/integration test
infrastructure.
-
+
@public
@for @ember/test
@static
@@ -60244,10 +60244,10 @@ define("ember/index", ["exports", "require", "@ember/-internals/environment", "n
A function may be assigned to `Ember.onerror` to be called when Ember
internals encounter an error. This is useful for specialized error handling
and reporting code.
-
+
```javascript
import $ from 'jquery';
-
+
Ember.onerror = function(error) {
$.ajax('/report-error', 'POST', {
stack: error.stack,
@@ -60255,9 +60255,9 @@ define("ember/index", ["exports", "require", "@ember/-internals/environment", "n
});
};
```
-
+
Internally, `Ember.onerror` is used as Backburner's error handler.
-
+
@event onerror
@for Ember
@param {Exception} error the error object
@@ -60305,7 +60305,7 @@ define("ember/index", ["exports", "require", "@ember/-internals/environment", "n
/**
Namespace for injection helper methods.
-
+
@class inject
@namespace Ember
@static
@@ -60381,7 +60381,7 @@ define("ember/index", ["exports", "require", "@ember/-internals/environment", "n
Defines the hash of localized strings for the current language. Used by
the `String.loc` helper. To localize, add string values to this
hash.
-
+
@property STRINGS
@for Ember
@type Object
@@ -60395,13 +60395,13 @@ define("ember/index", ["exports", "require", "@ember/-internals/environment", "n
});
/**
Whether searching on the global for new Namespace instances is enabled.
-
+
This is only exported here as to not break any addons. Given the new
visit API, you will have issues if you treat this as a indicator of
booted.
-
+
Internally this is only exposing a flag in Namespace.
-
+
@property BOOTED
@for Ember
@type Boolean
@@ -60458,7 +60458,7 @@ define("ember/index", ["exports", "require", "@ember/-internals/environment", "n
Global hash of shared templates. This will automatically be populated
by the build tools so that you can store your Handlebars templates in
separate files that get loaded into JavaScript at buildtime.
-
+
@property TEMPLATES
@for Ember
@type Object
@@ -60473,7 +60473,7 @@ define("ember/index", ["exports", "require", "@ember/-internals/environment", "n
});
/**
The semantic version
-
+
@property VERSION
@type String
@public
@@ -60563,7 +60563,7 @@ define("ember/index", ["exports", "require", "@ember/-internals/environment", "n
/**
Alias for jQuery
-
+
@for jquery
@method $
@static
@@ -61554,7 +61554,7 @@ define("router_js", ["exports", "@ember/polyfills", "rsvp", "route-recognizer"],
}
/**
@private
-
+
Extracts query params from the end of an array
**/
@@ -61582,7 +61582,7 @@ define("router_js", ["exports", "@ember/polyfills", "rsvp", "route-recognizer"],
}
/**
@private
-
+
Coerces query param properties and array elements into strings.
**/
@@ -61696,7 +61696,7 @@ define("router_js", ["exports", "@ember/polyfills", "rsvp", "route-recognizer"],
explicitly via `abort` or by attempting another transition while a
previous one is still underway. An aborted transition can also
be `retry()`d later.
-
+
@class Transition
@constructor
@param {Object} router
@@ -62014,7 +62014,7 @@ define("router_js", ["exports", "@ember/polyfills", "rsvp", "route-recognizer"],
}
/**
@private
-
+
Logs and returns an instance of TransitionAborted.
*/
@@ -64026,31 +64026,31 @@ define("rsvp", ["exports"], function (_exports) {
/**
`Promise.resolve` returns a promise that will become resolved with the
passed `value`. It is shorthand for the following:
-
+
```javascript
import Promise from 'rsvp';
-
+
let promise = new Promise(function(resolve, reject){
resolve(1);
});
-
+
promise.then(function(value){
// value === 1
});
```
-
+
Instead of writing the above, your code now simply becomes the following:
-
+
```javascript
import Promise from 'rsvp';
-
+
let promise = RSVP.Promise.resolve(1);
-
+
promise.then(function(value){
// value === 1
});
```
-
+
@method resolve
@for Promise
@static
@@ -64465,43 +64465,43 @@ define("rsvp", ["exports"], function (_exports) {
is fulfilled with an array of fulfillment values for the passed promises, or
rejected with the reason of the first passed promise to be rejected. It casts all
elements of the passed iterable to promises as it runs this algorithm.
-
+
Example:
-
+
```javascript
import Promise, { resolve } from 'rsvp';
-
+
let promise1 = resolve(1);
let promise2 = resolve(2);
let promise3 = resolve(3);
let promises = [ promise1, promise2, promise3 ];
-
+
Promise.all(promises).then(function(array){
// The array here would be [ 1, 2, 3 ];
});
```
-
+
If any of the `promises` given to `RSVP.all` are rejected, the first promise
that is rejected will be given as an argument to the returned promises's
rejection handler. For example:
-
+
Example:
-
+
```javascript
import Promise, { resolve, reject } from 'rsvp';
-
+
let promise1 = resolve(1);
let promise2 = reject(new Error("2"));
let promise3 = reject(new Error("3"));
let promises = [ promise1, promise2, promise3 ];
-
+
Promise.all(promises).then(function(array){
// Code here never runs because there are rejected promises!
}, function(error) {
// error.message === "2"
});
```
-
+
@method all
@for Promise
@param {Array} entries array of promises
@@ -64525,51 +64525,51 @@ define("rsvp", ["exports"], function (_exports) {
/**
`Promise.race` returns a new promise which is settled in the same way as the
first passed promise to settle.
-
+
Example:
-
+
```javascript
import Promise from 'rsvp';
-
+
let promise1 = new Promise(function(resolve, reject){
setTimeout(function(){
resolve('promise 1');
}, 200);
});
-
+
let promise2 = new Promise(function(resolve, reject){
setTimeout(function(){
resolve('promise 2');
}, 100);
});
-
+
Promise.race([promise1, promise2]).then(function(result){
// result === 'promise 2' because it was resolved before promise1
// was resolved.
});
```
-
+
`Promise.race` is deterministic in that only the state of the first
settled promise matters. For example, even if other promises given to the
`promises` array argument are resolved, but the first settled promise has
become rejected before the other promises became fulfilled, the returned
promise will become rejected:
-
+
```javascript
import Promise from 'rsvp';
-
+
let promise1 = new Promise(function(resolve, reject){
setTimeout(function(){
resolve('promise 1');
}, 200);
});
-
+
let promise2 = new Promise(function(resolve, reject){
setTimeout(function(){
reject(new Error('promise 2'));
}, 100);
});
-
+
Promise.race([promise1, promise2]).then(function(result){
// Code here never runs
}, function(reason){
@@ -64577,15 +64577,15 @@ define("rsvp", ["exports"], function (_exports) {
// promise 1 became fulfilled
});
```
-
+
An example real-world use case is implementing timeouts:
-
+
```javascript
import Promise from 'rsvp';
-
+
Promise.race([ajax('foo.json'), timeout(5000)])
```
-
+
@method race
@for Promise
@static
@@ -64616,35 +64616,35 @@ define("rsvp", ["exports"], function (_exports) {
/**
`Promise.reject` returns a promise rejected with the passed `reason`.
It is shorthand for the following:
-
+
```javascript
import Promise from 'rsvp';
-
+
let promise = new Promise(function(resolve, reject){
reject(new Error('WHOOPS'));
});
-
+
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
-
+
Instead of writing the above, your code now simply becomes the following:
-
+
```javascript
import Promise from 'rsvp';
-
+
let promise = Promise.reject(new Error('WHOOPS'));
-
+
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
-
+
@method reject
@for Promise
@static
@@ -64678,66 +64678,66 @@ define("rsvp", ["exports"], function (_exports) {
primary way of interacting with a promise is through its `then` method, which
registers callbacks to receive either a promise’s eventual value or the reason
why the promise cannot be fulfilled.
-
+
Terminology
-----------
-
+
- `promise` is an object or function with a `then` method whose behavior conforms to this specification.
- `thenable` is an object or function that defines a `then` method.
- `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
- `exception` is a value that is thrown using the throw statement.
- `reason` is a value that indicates why a promise was rejected.
- `settled` the final resting state of a promise, fulfilled or rejected.
-
+
A promise can be in one of three states: pending, fulfilled, or rejected.
-
+
Promises that are fulfilled have a fulfillment value and are in the fulfilled
state. Promises that are rejected have a rejection reason and are in the
rejected state. A fulfillment value is never a thenable.
-
+
Promises can also be said to *resolve* a value. If this value is also a
promise, then the original promise's settled state will match the value's
settled state. So a promise that *resolves* a promise that rejects will
itself reject, and a promise that *resolves* a promise that fulfills will
itself fulfill.
-
-
+
+
Basic Usage:
------------
-
+
```js
let promise = new Promise(function(resolve, reject) {
// on success
resolve(value);
-
+
// on failure
reject(reason);
});
-
+
promise.then(function(value) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
-
+
Advanced Usage:
---------------
-
+
Promises shine when abstracting away asynchronous interactions such as
`XMLHttpRequest`s.
-
+
```js
function getJSON(url) {
return new Promise(function(resolve, reject){
let xhr = new XMLHttpRequest();
-
+
xhr.open('GET', url);
xhr.onreadystatechange = handler;
xhr.responseType = 'json';
xhr.setRequestHeader('Accept', 'application/json');
xhr.send();
-
+
function handler() {
if (this.readyState === this.DONE) {
if (this.status === 200) {
@@ -64749,16 +64749,16 @@ define("rsvp", ["exports"], function (_exports) {
};
});
}
-
+
getJSON('/posts.json').then(function(json) {
// on fulfillment
}, function(reason) {
// on rejection
});
```
-
+
Unlike callbacks, promises are great composable primitives.
-
+
```js
Promise.all([
getJSON('/posts'),
@@ -64766,11 +64766,11 @@ define("rsvp", ["exports"], function (_exports) {
]).then(function(values){
values[0] // => postsJSON
values[1] // => commentsJSON
-
+
return values;
});
```
-
+
@class Promise
@public
@param {function} resolver
@@ -64805,25 +64805,25 @@ define("rsvp", ["exports"], function (_exports) {
/**
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
as the catch block of a try/catch statement.
-
+
```js
function findAuthor(){
throw new Error('couldn\'t find that author');
}
-
+
// synchronous
try {
findAuthor();
} catch(reason) {
// something went wrong
}
-
+
// async with promises
findAuthor().catch(function(reason){
// something went wrong
});
```
-
+
@method catch
@param {Function} onRejection
@param {String} [label] optional string for labeling the promise.
@@ -64838,9 +64838,9 @@ define("rsvp", ["exports"], function (_exports) {
/**
`finally` will be invoked regardless of the promise's fate just as native
try/catch/finally behaves
-
+
Synchronous example:
-
+
```js
findAuthor() {
if (Math.random() > 0.5) {
@@ -64848,7 +64848,7 @@ define("rsvp", ["exports"], function (_exports) {
}
return new Author();
}
-
+
try {
return findAuthor(); // succeed or fail
} catch(error) {
@@ -64858,9 +64858,9 @@ define("rsvp", ["exports"], function (_exports) {
// doesn't affect the return value
}
```
-
+
Asynchronous example:
-
+
```js
findAuthor().catch(function(reason){
return findOtherAuthor();
@@ -64868,7 +64868,7 @@ define("rsvp", ["exports"], function (_exports) {
// author was either found, or not
});
```
-
+
@method finally
@param {Function} callback
@param {String} [label] optional string for labeling the promise.
@@ -64904,7 +64904,7 @@ define("rsvp", ["exports"], function (_exports) {
The primary way of interacting with a promise is through its `then` method,
which registers callbacks to receive either a promise's eventual value or the
reason why the promise cannot be fulfilled.
-
+
```js
findUser().then(function(user){
// user is available
@@ -64912,14 +64912,14 @@ define("rsvp", ["exports"], function (_exports) {
// user is unavailable, and you are given the reason why
});
```
-
+
Chaining
--------
-
+
The return value of `then` is itself a promise. This second, 'downstream'
promise is resolved with the return value of the first promise's fulfillment
or rejection handler, or rejected if the handler throws an exception.
-
+
```js
findUser().then(function (user) {
return user.name;
@@ -64929,7 +64929,7 @@ define("rsvp", ["exports"], function (_exports) {
// If `findUser` fulfilled, `userName` will be the user's name, otherwise it
// will be `'default name'`
});
-
+
findUser().then(function (user) {
throw new Error('Found user, but still unhappy');
}, function (reason) {
@@ -64942,7 +64942,7 @@ define("rsvp", ["exports"], function (_exports) {
});
```
If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
-
+
```js
findUser().then(function (user) {
throw new PedagogicalException('Upstream error');
@@ -64954,15 +64954,15 @@ define("rsvp", ["exports"], function (_exports) {
// The `PedgagocialException` is propagated all the way down to here
});
```
-
+
Assimilation
------------
-
+
Sometimes the value you want to propagate to a downstream promise can only be
retrieved asynchronously. This can be achieved by returning a promise in the
fulfillment or rejection handler. The downstream promise will then be pending
until the returned promise is settled. This is called *assimilation*.
-
+
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
@@ -64970,9 +64970,9 @@ define("rsvp", ["exports"], function (_exports) {
// The user's comments are now available
});
```
-
+
If the assimliated promise rejects, then the downstream promise will also reject.
-
+
```js
findUser().then(function (user) {
return findCommentsByAuthor(user);
@@ -64982,15 +64982,15 @@ define("rsvp", ["exports"], function (_exports) {
// If `findCommentsByAuthor` rejects, we'll have the reason here
});
```
-
+
Simple Example
--------------
-
+
Synchronous Example
-
+
```javascript
let result;
-
+
try {
result = findResult();
// success
@@ -64998,9 +64998,9 @@ define("rsvp", ["exports"], function (_exports) {
// failure
}
```
-
+
Errback Example
-
+
```js
findResult(function(result, err){
if (err) {
@@ -65010,9 +65010,9 @@ define("rsvp", ["exports"], function (_exports) {
}
});
```
-
+
Promise Example;
-
+
```javascript
findResult().then(function(result){
// success
@@ -65020,15 +65020,15 @@ define("rsvp", ["exports"], function (_exports) {
// failure
});
```
-
+
Advanced Example
--------------
-
+
Synchronous Example
-
+
```javascript
let author, books;
-
+
try {
author = findAuthor();
books = findBooksByAuthor(author);
@@ -65037,19 +65037,19 @@ define("rsvp", ["exports"], function (_exports) {
// failure
}
```
-
+
Errback Example
-
+
```js
-
+
function foundBooks(books) {
-
+
}
-
+
function failure(reason) {
-
+
}
-
+
findAuthor(function(author, err){
if (err) {
failure(err);
@@ -65074,9 +65074,9 @@ define("rsvp", ["exports"], function (_exports) {
}
});
```
-
+
Promise Example;
-
+
```javascript
findAuthor().
then(findBooksByAuthor).
@@ -65086,7 +65086,7 @@ define("rsvp", ["exports"], function (_exports) {
// something went wrong
});
```
-
+
@method then
@param {Function} onFulfillment
@param {Function} onRejection
@@ -65138,87 +65138,87 @@ define("rsvp", ["exports"], function (_exports) {
will return an `Promise`. You can use `denodeify` in Node.js or the
browser when you'd prefer to use promises over using callbacks. For example,
`denodeify` transforms the following:
-
+
```javascript
let fs = require('fs');
-
+
fs.readFile('myfile.txt', function(err, data){
if (err) return handleError(err);
handleData(data);
});
```
-
+
into:
-
+
```javascript
let fs = require('fs');
let readFile = denodeify(fs.readFile);
-
+
readFile('myfile.txt').then(handleData, handleError);
```
-
+
If the node function has multiple success parameters, then `denodeify`
just returns the first one:
-
+
```javascript
let request = denodeify(require('request'));
-
+
request('http://example.com').then(function(res) {
// ...
});
```
-
+
However, if you need all success parameters, setting `denodeify`'s
second parameter to `true` causes it to return all success parameters
as an array:
-
+
```javascript
let request = denodeify(require('request'), true);
-
+
request('http://example.com').then(function(result) {
// result[0] -> res
// result[1] -> body
});
```
-
+
Or if you pass it an array with names it returns the parameters as a hash:
-
+
```javascript
let request = denodeify(require('request'), ['res', 'body']);
-
+
request('http://example.com').then(function(result) {
// result.res
// result.body
});
```
-
+
Sometimes you need to retain the `this`:
-
+
```javascript
let app = require('express')();
let render = denodeify(app.render.bind(app));
```
-
+
The denodified function inherits from the original function. It works in all
environments, except IE 10 and below. Consequently all properties of the original
function are available to you. However, any properties you change on the
denodeified function won't be changed on the original function. Example:
-
+
```javascript
let request = denodeify(require('request')),
cookieJar = request.jar(); // <- Inheritance is used here
-
+
request('http://example.com', {jar: cookieJar}).then(function(res) {
// cookieJar.cookies holds now the cookies returned by example.com
});
```
-
+
Using `denodeify` makes it easier to compose asynchronous operations instead
of using callbacks. For example, instead of:
-
+
```javascript
let fs = require('fs');
-
+
fs.readFile('myfile.txt', function(err, data){
if (err) { ... } // Handle error
fs.writeFile('myfile2.txt', data, function(err){
@@ -65227,14 +65227,14 @@ define("rsvp", ["exports"], function (_exports) {
});
});
```
-
+
you can chain the operations together using `then` from the returned promise:
-
+
```javascript
let fs = require('fs');
let readFile = denodeify(fs.readFile);
let writeFile = denodeify(fs.writeFile);
-
+
readFile('myfile.txt').then(function(data){
return writeFile('myfile2.txt', data);
}).then(function(){
@@ -65243,7 +65243,7 @@ define("rsvp", ["exports"], function (_exports) {
// Handle error
});
```
-
+
@method denodeify
@public
@static
@@ -65338,7 +65338,7 @@ define("rsvp", ["exports"], function (_exports) {
}
/**
This is a convenient alias for `Promise.all`.
-
+
@method all
@public
@static
@@ -65423,7 +65423,7 @@ define("rsvp", ["exports"], function (_exports) {
}
/**
This is a convenient alias for `Promise.race`.
-
+
@method race
@public
@static
@@ -65470,15 +65470,15 @@ define("rsvp", ["exports"], function (_exports) {
/**
`hash` is similar to `all`, but takes an object instead of an array
for its `promises` argument.
-
+
Returns a promise that is fulfilled when all the given promises have been
fulfilled, or rejected if any of them become rejected. The returned promise
is fulfilled with a hash that has the same key names as the `promises` object
argument. If any of the values in the object are not promises, they will
simply be copied over to the fulfilled object.
-
+
Example:
-
+
```javascript
let promises = {
myPromise: resolve(1),
@@ -65486,7 +65486,7 @@ define("rsvp", ["exports"], function (_exports) {
theirPromise: resolve(3),
notAPromise: 4
};
-
+
hash(promises).then(function(hash){
// hash here is an object that looks like:
// {
@@ -65497,44 +65497,44 @@ define("rsvp", ["exports"], function (_exports) {
// }
});
```
-
+
If any of the `promises` given to `hash` are rejected, the first promise
that is rejected will be given as the reason to the rejection handler.
-
+
Example:
-
+
```javascript
let promises = {
myPromise: resolve(1),
rejectedPromise: reject(new Error('rejectedPromise')),
anotherRejectedPromise: reject(new Error('anotherRejectedPromise')),
};
-
+
hash(promises).then(function(hash){
// Code here never runs because there are rejected promises!
}, function(reason) {
// reason.message === 'rejectedPromise'
});
```
-
+
An important note: `hash` is intended for plain JavaScript objects that
are just a set of keys and values. `hash` will NOT preserve prototype
chains.
-
+
Example:
-
+
```javascript
import { hash, resolve } from 'rsvp';
function MyConstructor(){
this.example = resolve('Example');
}
-
+
MyConstructor.prototype = {
protoProperty: resolve('Proto Property')
};
-
+
let myObject = new MyConstructor();
-
+
hash(myObject).then(function(hash){
// protoProperty will not be present, instead you will just have an
// object that looks like:
@@ -65546,7 +65546,7 @@ define("rsvp", ["exports"], function (_exports) {
// 'undefined' === typeof hash.protoProperty
});
```
-
+
@method hash
@public
@static
@@ -65580,33 +65580,33 @@ define("rsvp", ["exports"], function (_exports) {
/**
`hashSettled` is similar to `allSettled`, but takes an object
instead of an array for its `promises` argument.
-
+
Unlike `all` or `hash`, which implement a fail-fast method,
but like `allSettled`, `hashSettled` waits until all the
constituent promises have returned and then shows you all the results
with their states and values/reasons. This is useful if you want to
handle multiple promises' failure states together as a set.
-
+
Returns a promise that is fulfilled when all the given promises have been
settled, or rejected if the passed parameters are invalid.
-
+
The returned promise is fulfilled with a hash that has the same key names as
the `promises` object argument. If any of the values in the object are not
promises, they will be copied over to the fulfilled object and marked with state
'fulfilled'.
-
+
Example:
-
+
```javascript
import { hashSettled, resolve } from 'rsvp';
-
+
let promises = {
myPromise: resolve(1),
yourPromise: resolve(2),
theirPromise: resolve(3),
notAPromise: 4
};
-
+
hashSettled(promises).then(function(hash){
// hash here is an object that looks like:
// {
@@ -65617,21 +65617,21 @@ define("rsvp", ["exports"], function (_exports) {
// }
});
```
-
+
If any of the `promises` given to `hash` are rejected, the state will
be set to 'rejected' and the reason for rejection provided.
-
+
Example:
-
+
```javascript
import { hashSettled, reject, resolve } from 'rsvp';
-
+
let promises = {
myPromise: resolve(1),
rejectedPromise: reject(new Error('rejection')),
anotherRejectedPromise: reject(new Error('more rejection')),
};
-
+
hashSettled(promises).then(function(hash){
// hash here is an object that looks like:
// {
@@ -65643,26 +65643,26 @@ define("rsvp", ["exports"], function (_exports) {
// and for anotherRejectedPromise, reason.message == 'more rejection'.
});
```
-
+
An important note: `hashSettled` is intended for plain JavaScript objects that
are just a set of keys and values. `hashSettled` will NOT preserve prototype
chains.
-
+
Example:
-
+
```javascript
import Promise, { hashSettled, resolve } from 'rsvp';
-
+
function MyConstructor(){
this.example = resolve('Example');
}
-
+
MyConstructor.prototype = {
protoProperty: Promise.resolve('Proto Property')
};
-
+
let myObject = new MyConstructor();
-
+
hashSettled(myObject).then(function(hash){
// protoProperty will not be present, instead you will just have an
// object that looks like:
@@ -65674,7 +65674,7 @@ define("rsvp", ["exports"], function (_exports) {
// 'undefined' === typeof hash.protoProperty
});
```
-
+
@method hashSettled
@public
@for rsvp
@@ -65698,7 +65698,7 @@ define("rsvp", ["exports"], function (_exports) {
/**
`rethrow` will rethrow an error on the next turn of the JavaScript event
loop in order to aid debugging.
-
+
Promises A+ specifies that any exceptions that occur with a promise must be
caught by the promises implementation and bubbled to the last handler. For
this reason, it is recommended that you always specify a second rejection
@@ -65706,18 +65706,18 @@ define("rsvp", ["exports"], function (_exports) {
outside of the promise, so it bubbles up to your console if in the browser,
or domain/cause uncaught exception in Node. `rethrow` will also throw the
error again so the error can be handled by the promise per the spec.
-
+
```javascript
import { rethrow } from 'rsvp';
-
+
function throws(){
throw new Error('Whoops!');
}
-
+
let promise = new Promise(function(resolve, reject){
throws();
});
-
+
promise.catch(rethrow).then(function(){
// Code here doesn't run because the promise became rejected due to an
// error!
@@ -65725,11 +65725,11 @@ define("rsvp", ["exports"], function (_exports) {
// handle the error here
});
```
-
+
The 'Whoops' error will be thrown on the next turn of the event loop
and you can watch for it in your console. You can also handle it using a
rejection handler given to `.then` or `.catch` on the returned promise.
-
+
@method rethrow
@public
@static
@@ -65750,27 +65750,27 @@ define("rsvp", ["exports"], function (_exports) {
`defer` returns an object similar to jQuery's `$.Deferred`.
`defer` should be used when porting over code reliant on `$.Deferred`'s
interface. New code should use the `Promise` constructor instead.
-
+
The object returned from `defer` is a plain object with three properties:
-
+
* promise - an `Promise`.
* reject - a function that causes the `promise` property on this object to
become rejected
* resolve - a function that causes the `promise` property on this object to
become fulfilled.
-
+
Example:
-
+
```javascript
let deferred = defer();
-
+
deferred.resolve("Success!");
-
+
deferred.promise.then(function(value){
// value here is "Success!"
});
```
-
+
@method defer
@public
@static
@@ -65827,62 +65827,62 @@ define("rsvp", ["exports"], function (_exports) {
meaning that as soon as any promise resolves its value will be passed to `mapFn`.
`map` returns a promise that will become fulfilled with the result of running
`mapFn` on the values the promises become fulfilled with.
-
+
For example:
-
+
```javascript
import { map, resolve } from 'rsvp';
-
+
let promise1 = resolve(1);
let promise2 = resolve(2);
let promise3 = resolve(3);
let promises = [ promise1, promise2, promise3 ];
-
+
let mapFn = function(item){
return item + 1;
};
-
+
map(promises, mapFn).then(function(result){
// result is [ 2, 3, 4 ]
});
```
-
+
If any of the `promises` given to `map` are rejected, the first promise
that is rejected will be given as an argument to the returned promise's
rejection handler. For example:
-
+
```javascript
import { map, reject, resolve } from 'rsvp';
-
+
let promise1 = resolve(1);
let promise2 = reject(new Error('2'));
let promise3 = reject(new Error('3'));
let promises = [ promise1, promise2, promise3 ];
-
+
let mapFn = function(item){
return item + 1;
};
-
+
map(promises, mapFn).then(function(array){
// Code here never runs because there are rejected promises!
}, function(reason) {
// reason.message === '2'
});
```
-
+
`map` will also wait if a promise is returned from `mapFn`. For example,
say you want to get all comments from a set of blog posts, but you need
the blog posts first because they contain a url to those comments.
-
+
```javscript
import { map } from 'rsvp';
-
+
let mapFn = function(blogPost){
// getComments does some ajax and returns an Promise that is fulfilled
// with some comments data
return getComments(blogPost.comments_url);
};
-
+
// getBlogPosts does some ajax and returns an Promise that is fulfilled
// with some blog post data
map(getBlogPosts(), mapFn).then(function(comments){
@@ -65890,7 +65890,7 @@ define("rsvp", ["exports"], function (_exports) {
// of all blog posts returned from getBlogPosts()
});
```
-
+
@method map
@public
@static
@@ -65920,7 +65920,7 @@ define("rsvp", ["exports"], function (_exports) {
}
/**
This is a convenient alias for `Promise.resolve`.
-
+
@method resolve
@public
@static
@@ -65938,7 +65938,7 @@ define("rsvp", ["exports"], function (_exports) {
}
/**
This is a convenient alias for `Promise.reject`.
-
+
@method reject
@public
@static
@@ -65999,65 +65999,65 @@ define("rsvp", ["exports"], function (_exports) {
resolves its value will be passed to `filterFn`. `filter` returns
a promise that will become fulfilled with the result of running
`filterFn` on the values the promises become fulfilled with.
-
+
For example:
-
+
```javascript
import { filter, resolve } from 'rsvp';
-
+
let promise1 = resolve(1);
let promise2 = resolve(2);
let promise3 = resolve(3);
-
+
let promises = [promise1, promise2, promise3];
-
+
let filterFn = function(item){
return item > 1;
};
-
+
filter(promises, filterFn).then(function(result){
// result is [ 2, 3 ]
});
```
-
+
If any of the `promises` given to `filter` are rejected, the first promise
that is rejected will be given as an argument to the returned promise's
rejection handler. For example:
-
+
```javascript
import { filter, reject, resolve } from 'rsvp';
-
+
let promise1 = resolve(1);
let promise2 = reject(new Error('2'));
let promise3 = reject(new Error('3'));
let promises = [ promise1, promise2, promise3 ];
-
+
let filterFn = function(item){
return item > 1;
};
-
+
filter(promises, filterFn).then(function(array){
// Code here never runs because there are rejected promises!
}, function(reason) {
// reason.message === '2'
});
```
-
+
`filter` will also wait for any promises returned from `filterFn`.
For instance, you may want to fetch a list of users then return a subset
of those users based on some asynchronous operation:
-
+
```javascript
import { filter, resolve } from 'rsvp';
-
+
let alice = { name: 'alice' };
let bob = { name: 'bob' };
let users = [ alice, bob ];
-
+
let promises = users.map(function(user){
return resolve(user);
});
-
+
let filterFn = function(user){
// Here, Alice has permissions to create a blog post, but Bob does not.
return getPrivilegesForUser(user).then(function(privs){
@@ -66071,7 +66071,7 @@ define("rsvp", ["exports"], function (_exports) {
users[0] === bob;
});
```
-
+
@method filter
@public
@static
@@ -66964,7 +66964,7 @@ require('ember');
during a request to an external API. It indicates a generic error, and
subclasses are used to indicate specific error states. The following
subclasses are provided:
-
+
- `InvalidError`
- `TimeoutError`
- `AbortError`
@@ -66973,42 +66973,42 @@ require('ember');
- `NotFoundError`
- `ConflictError`
- `ServerError`
-
+
To create a custom error to signal a specific error state in communicating
with an external API, extend the `AdapterError`. For example, if the
external API exclusively used HTTP `503 Service Unavailable` to indicate
it was closed for maintenance:
-
+
```app/adapters/maintenance-error.js
import AdapterError from '@ember-data/adapter/error';
-
+
export default AdapterError.extend({ message: "Down for maintenance." });
```
-
+
This error would then be returned by an adapter's `handleResponse` method:
-
+
```app/adapters/application.js
import JSONAPIAdapter from '@ember-data/adapter/json-api';
import MaintenanceError from './maintenance-error';
-
+
export default JSONAPIAdapter.extend({
handleResponse(status) {
if (503 === status) {
return new MaintenanceError();
}
-
+
return this._super(...arguments);
}
});
```
-
+
And can then be detected in an application and used to send the user to an
`under-maintenance` route:
-
+
```app/routes/application.js
import Route from '@ember/routing/route';
import MaintenanceError from '../adapters/maintenance-error';
-
+
export default Route.extend({
actions: {
error(error, transition) {
@@ -67016,13 +67016,13 @@ require('ember');
this.transitionTo('under-maintenance');
return;
}
-
+
// ...other error handling logic
}
}
});
```
-
+
@class AdapterError
*/
function AdapterError(errors, message = 'Adapter operation failed') {
@@ -67079,31 +67079,31 @@ require('ember');
from an adapter is rejected with a `InvalidError` the record will
transition to the `invalid` state and the errors will be set to the
`errors` property on the record.
-
+
For Ember Data to correctly map errors to their corresponding
properties on the model, Ember Data expects each error to be
a valid JSON-API error object with a `source/pointer` that matches
the property name. For example, if you had a Post model that
looked like this.
-
+
```app/models/post.js
import Model, { attr } from '@ember-data/model';
-
+
export default Model.extend({
title: attr('string'),
content: attr('string')
});
```
-
+
To show an error from the server related to the `title` and
`content` properties your adapter could return a promise that
rejects with a `InvalidError` object that looks like this:
-
+
```app/adapters/post.js
import RSVP from 'RSVP';
import RESTAdapter from '@ember-data/adapter/rest';
import { InvalidError } from '@ember-data/adapter/error';
-
+
export default RESTAdapter.extend({
updateRecord() {
// Fictional adapter that always rejects
@@ -67120,13 +67120,13 @@ require('ember');
}
});
```
-
+
Your backend may use different property names for your records the
store will attempt to extract and normalize the errors using the
serializer's `extractErrors` method before the errors get added to
the model. As a result, it is safe for the `InvalidError` to
wrap the error payload unaltered.
-
+
@class InvalidError
@extends AdapterError
*/
@@ -67138,15 +67138,15 @@ require('ember');
A `TimeoutError` is used by an adapter to signal that a request
to the external API has timed out. I.e. no response was received from
the external API within an allowed time period.
-
+
An example use case would be to warn the user to check their internet
connection if an adapter operation has timed out:
-
+
```app/routes/application.js
import Route from '@ember/routing/route';
import { TimeoutError } from '@ember-data/adapter/error';
import { action } from '@ember/object';
-
+
export default class ApplicationRoute extends Route {
@action
error(error, transition) {
@@ -67155,12 +67155,12 @@ require('ember');
alert('Are you still connected to the Internet?');
return;
}
-
+
// ...other error handling logic
}
}
```
-
+
@class TimeoutError
@extends AdapterError
*/
@@ -67173,7 +67173,7 @@ require('ember');
the external API was aborted. For example, this can occur if the user
navigates away from the current page after a request to the external API
has been initiated but before a response has been received.
-
+
@class AbortError
@extends AdapterError
*/
@@ -67186,15 +67186,15 @@ require('ember');
status. It is used by an adapter to signal that a request to the external
API was rejected because authorization is required and has failed or has not
yet been provided.
-
+
An example use case would be to redirect the user to a login route if a
request is unauthorized:
-
+
```app/routes/application.js
import Route from '@ember/routing/route';
import { UnauthorizedError } from '@ember-data/adapter/error';
import { action } from '@ember/object';
-
+
export default class ApplicationRoute extends Route {
@action
error(error, transition) {
@@ -67203,12 +67203,12 @@ require('ember');
this.transitionTo('login');
return;
}
-
+
// ...other error handling logic
}
}
```
-
+
@class UnauthorizedError
@extends AdapterError
*/
@@ -67222,7 +67222,7 @@ require('ember');
valid but the server is refusing to respond to it. If authorization was
provided and is valid, then the authenticated user does not have the
necessary permissions for the request.
-
+
@class ForbiddenError
@extends AdapterError
*/
@@ -67234,16 +67234,16 @@ require('ember');
A `NotFoundError` equates to a HTTP `404 Not Found` response status.
It is used by an adapter to signal that a request to the external API
was rejected because the resource could not be found on the API.
-
+
An example use case would be to detect if the user has entered a route
for a specific model that does not exist. For example:
-
+
```app/routes/post.js
import Route from '@ember/routing/route';
import { NotFoundError } from '@ember-data/adapter/error';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
-
+
export default class PostRoute extends Route {
@service store;
model(params) {
@@ -67261,7 +67261,7 @@ require('ember');
}
}
```
-
+
@class NotFoundError
@extends AdapterError
*/
@@ -67275,7 +67275,7 @@ require('ember');
because of a conflict in the request. An example scenario would be when
creating a record with a client-generated ID but that ID is already known
to the external API.
-
+
@class ConflictError
@extends AdapterError
*/
@@ -67287,7 +67287,7 @@ require('ember');
A `ServerError` equates to a HTTP `500 Internal Server Error` response
status. It is used by the adapter to indicate that a request has failed
because of an error in the external API.
-
+
@class ServerError
@extends AdapterError
*/
@@ -67317,50 +67317,50 @@ require('ember');
may be anything, such as the browser's local storage. Typically the
adapter is not invoked directly instead its functionality is accessed
through the `store`.
-
+
### Creating an Adapter
-
+
Create a new subclass of `Adapter` in the `app/adapters` folder:
-
+
```app/adapters/application.js
import Adapter from '@ember-data/adapter';
-
+
export default Adapter.extend({
// ...your code here
});
```
-
+
Model-specific adapters can be created by putting your adapter
class in an `app/adapters/` + `model-name` + `.js` file of the application.
-
+
```app/adapters/post.js
import Adapter from '@ember-data/adapter';
-
+
export default Adapter.extend({
// ...Post-specific adapter code goes here
});
```
-
+
`Adapter` is an abstract base class that you should override in your
application to customize it for your backend. The minimum set of methods
that you should implement is:
-
+
* `findRecord()`
* `createRecord()`
* `updateRecord()`
* `deleteRecord()`
* `findAll()`
* `query()`
-
+
To improve the network performance of your application, you can optimize
your adapter by overriding these lower-level methods:
-
+
* `findMany()`
-
-
+
+
For an example of the implementation, see `RESTAdapter`, the
included REST adapter.
-
+
@module @ember-data/adapter
@class Adapter
@extends EmberObject
@@ -67901,14 +67901,14 @@ require('ember');
is responsible for transforming the store's requests into HTTP
requests that follow the [JSON API](http://jsonapi.org/format/)
format.
-
+
## JSON API Conventions
-
+
The JSONAPIAdapter uses JSON API conventions for building the URL
for a record and selecting the HTTP verb to use with a request. The
actions you can take on a record map onto the following URLs in the
JSON API adapter:
-
+
@@ -67977,55 +67977,55 @@ require('ember');
-
+
## Success and failure
-
+
The JSONAPIAdapter will consider a success any response with a
status code of the 2xx family ("Success"), as well as 304 ("Not
Modified"). Any other status code will be considered a failure.
-
+
On success, the request promise will be resolved with the full
response payload.
-
+
Failed responses with status code 422 ("Unprocessable Entity") will
be considered "invalid". The response will be discarded, except for
the `errors` key. The request promise will be rejected with a
`InvalidError`. This error object will encapsulate the saved
`errors` value.
-
+
Any other status codes will be treated as an adapter error. The
request promise will be rejected, similarly to the invalid case,
but with an instance of `AdapterError` instead.
-
+
### Endpoint path customization
-
+
Endpoint paths can be prefixed with a `namespace` by setting the
namespace property on the adapter:
-
+
```app/adapters/application.js
import JSONAPIAdapter from '@ember-data/adapter/json-api';
-
+
export default JSONAPIAdapter.extend({
namespace: 'api/1'
});
```
Requests for the `person` model would now target `/api/1/people/1`.
-
+
### Host customization
-
+
An adapter can target other hosts by setting the `host` property.
-
+
```app/adapters/application.js
import JSONAPIAdapter from '@ember-data/adapter/json-api';
-
+
export default JSONAPIAdapter.extend({
host: 'https://api.example.com'
});
```
-
+
Requests for the `person` model would now target
`https://api.example.com/people/1`.
-
+
@since 1.13.0
@class JSONAPIAdapter
@constructor
@@ -68139,39 +68139,39 @@ require('ember');
The REST adapter allows your store to communicate with an HTTP server by
transmitting JSON via XHR. Most Ember.js apps that consume a JSON API
should use the REST adapter.
-
+
This adapter is designed around the idea that the JSON exchanged with
the server should be conventional.
-
+
## Success and failure
-
+
The REST adapter will consider a success any response with a status code
of the 2xx family ("Success"), as well as 304 ("Not Modified"). Any other
status code will be considered a failure.
-
+
On success, the request promise will be resolved with the full response
payload.
-
+
Failed responses with status code 422 ("Unprocessable Entity") will be
considered "invalid". The response will be discarded, except for the
`errors` key. The request promise will be rejected with a `InvalidError`.
This error object will encapsulate the saved `errors` value.
-
+
Any other status codes will be treated as an "adapter error". The request
promise will be rejected, similarly to the "invalid" case, but with
an instance of `AdapterError` instead.
-
+
## JSON Structure
-
+
The REST adapter expects the JSON returned from your server to follow
these conventions.
-
+
### Object Root
-
+
The JSON payload should be an object that contains the record inside a
root property. For example, in response to a `GET` request for
`/posts/1`, the JSON should look like this:
-
+
```js
{
"posts": {
@@ -68181,10 +68181,10 @@ require('ember');
}
}
```
-
+
Similarly, in response to a `GET` request for `/posts`, the JSON should
look like this:
-
+
```js
{
"posts": [
@@ -68201,32 +68201,32 @@ require('ember');
]
}
```
-
+
Note that the object root can be pluralized for both a single-object response
and an array response: the REST adapter is not strict on this. Further, if the
HTTP server responds to a `GET` request to `/posts/1` (e.g. the response to a
`findRecord` query) with more than one object in the array, Ember Data will
only display the object with the matching ID.
-
+
### Conventional Names
-
+
Attribute names in your JSON payload should be the camelCased versions of
the attributes in your Ember.js models.
-
+
For example, if you have a `Person` model:
-
+
```app/models/person.js
import Model, { attr } from '@ember-data/model';
-
+
export default Model.extend({
firstName: attr('string'),
lastName: attr('string'),
occupation: attr('string')
});
```
-
+
The JSON returned should look like this:
-
+
```js
{
"people": {
@@ -68237,13 +68237,13 @@ require('ember');
}
}
```
-
+
#### Relationships
-
+
Relationships are usually represented by ids to the record in the
relationship. The related records can then be sideloaded in the
response under a key for the type.
-
+
```js
{
"posts": {
@@ -68263,13 +68263,13 @@ require('ember');
}]
}
```
-
+
If the records in the relationship are not known when the response
is serialized it's also possible to represent the relationship as a
URL using the `links` key in the response. Ember Data will fetch
this URL to resolve the relationship when it is accessed for the
first time.
-
+
```js
{
"posts": {
@@ -68282,12 +68282,12 @@ require('ember');
}
}
```
-
+
### Errors
-
+
If a response is considered a failure, the JSON payload is expected to include
a top-level key `errors`, detailing any specific issues. For example:
-
+
```js
{
"errors": {
@@ -68295,51 +68295,51 @@ require('ember');
}
}
```
-
+
This adapter does not make any assumptions as to the format of the `errors`
object. It will simply be passed along as is, wrapped in an instance
of `InvalidError` or `AdapterError`. The serializer can interpret it
afterwards.
-
+
## Customization
-
+
### Endpoint path customization
-
+
Endpoint paths can be prefixed with a `namespace` by setting the namespace
property on the adapter:
-
+
```app/adapters/application.js
import RESTAdapter from '@ember-data/adapter/rest';
-
+
export default RESTAdapter.extend({
namespace: 'api/1'
});
```
Requests for the `Person` model would now target `/api/1/people/1`.
-
+
### Host customization
-
+
An adapter can target other hosts by setting the `host` property.
-
+
```app/adapters/application.js
import RESTAdapter from '@ember-data/adapter/rest';
-
+
export default RESTAdapter.extend({
host: 'https://api.example.com'
});
```
-
+
### Headers customization
-
+
Some APIs require HTTP headers, e.g. to provide an API key. Arbitrary
headers can be set as key/value pairs on the `RESTAdapter`'s `headers`
object and Ember Data will send them along with each ajax request.
-
-
+
+
```app/adapters/application.js
import RESTAdapter from '@ember-data/adapter/rest';
import { computed } from '@ember/object';
-
+
export default RESTAdapter.extend({
headers: computed(function() {
return {
@@ -68349,15 +68349,15 @@ require('ember');
}
});
```
-
+
`headers` can also be used as a computed property to support dynamic
headers. In the example below, the `session` object has been
injected into an adapter by Ember's container.
-
+
```app/adapters/application.js
import RESTAdapter from '@ember-data/adapter/rest';
import { computed } from '@ember/object';
-
+
export default RESTAdapter.extend({
headers: computed('session.authToken', function() {
return {
@@ -68367,19 +68367,19 @@ require('ember');
})
});
```
-
+
In some cases, your dynamic headers may require data from some
object outside of Ember's observer system (for example
`document.cookie`). You can use the
[volatile](/api/classes/Ember.ComputedProperty.html?anchor=volatile)
function to set the property into a non-cached mode causing the headers to
be recomputed with every request.
-
+
```app/adapters/application.js
import RESTAdapter from '@ember-data/adapter/rest';
import { get } from '@ember/object';
import { computed } from '@ember/object';
-
+
export default RESTAdapter.extend({
headers: computed(function() {
return {
@@ -68389,7 +68389,7 @@ require('ember');
}).volatile()
});
```
-
+
@class RESTAdapter
@constructor
@extends Adapter
@@ -69158,7 +69158,7 @@ require('ember');
try {
return `${protocol}//${host}${url}`;
} catch (fbError) {
- throw new Error('You are using Ember Data with no host defined in your adapter. This will attempt to use the host of the FastBoot request, which is not configured for the current host of this request. Please set the hostWhitelist property for in your environment.js. FastBoot Error: ' + fbError.message);
+ throw new Error('You are using Ember Data with no host defined in your adapter. This will attempt to use the host of the FastBoot request, which is not configured for the current host of this request. Please set the hostAllowList property for in your environment.js. FastBoot Error: ' + fbError.message);
}
}
}
@@ -69612,9 +69612,9 @@ require('ember');
/*
This list of features is used both at build time (by `@ember-data/private-build-infra`)
and at runtime (by `@ember-data/canary-features`).
-
+
The valid values are:
-
+
- true - The feature is enabled at all times, and cannot be disabled.
- false - The feature is disabled at all times, and cannot be enabled.
- null - The feature is disabled by default, but can be enabled at runtime via `EmberDataENV`.
@@ -69675,7 +69675,7 @@ require('ember');
/**
Implements `@ember/debug/data-adapter` with for EmberData
integration with the ember-inspector.
-
+
@class InspectorDataAdapter
@extends DataAdapter
@private
@@ -75369,7 +75369,7 @@ require('ember');
`_attributes` then the user has a local changed to the attribute
that has not been synced with the server and the key is not
included in the list of changed keys.
-
+
If the value, for a key differs from the value in what Ember Data
believes to be the truth about the backend state (A merger of the
`_data` and `_inFlightAttributes` objects where
@@ -76466,17 +76466,17 @@ require('ember');
`Serializer` is an abstract base class that you should override in your
application to customize it for your backend. The minimum set of methods
that you should implement is:
-
+
* `normalizeResponse()`
* `serialize()`
-
+
And you can optionally override the following methods:
-
+
* `normalize()`
-
+
For an example implementation, see
[JSONSerializer](JSONSerializer), the included JSON serializer.
-
+
@class Serializer
@extends EmberObject
*/
@@ -76611,20 +76611,20 @@ require('ember');
/**
Ember Data 2.0 Serializer:
-
+
In Ember Data a Serializer is used to serialize and deserialize
records when they are transferred in and out of an external source.
This process involves normalizing property names, transforming
attribute values and serializing relationships.
-
+
`JSONAPISerializer` supports the http://jsonapi.org/ spec and is the
serializer recommended by Ember Data.
-
+
This serializer normalizes a JSON API payload that looks like:
-
+
```app/models/player.js
import Model, { attr, belongsTo } from '@ember-data/model';
-
+
export default Model.extend({
name: attr('string'),
skill: attr('string'),
@@ -76632,17 +76632,17 @@ require('ember');
club: belongsTo('club')
});
```
-
+
```app/models/club.js
import Model, { attr, hasMany } from '@ember-data/model';
-
+
export default Model.extend({
name: attr('string'),
location: attr('string'),
players: hasMany('player')
});
```
-
+
```js
{
"data": [
@@ -76686,40 +76686,40 @@ require('ember');
]
}
```
-
+
to the format that the Ember Data store expects.
-
+
### Customizing meta
-
+
Since a JSON API Document can have meta defined in multiple locations you can
use the specific serializer hooks if you need to customize the meta.
-
+
One scenario would be to camelCase the meta keys of your payload. The example
below shows how this could be done using `normalizeArrayResponse` and
`extractRelationship`.
-
+
```app/serializers/application.js
export default JSONAPISerializer.extend({
normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {
let normalizedDocument = this._super(...arguments);
-
+
// Customize document meta
normalizedDocument.meta = camelCaseKeys(normalizedDocument.meta);
-
+
return normalizedDocument;
},
-
+
extractRelationship(relationshipHash) {
let normalizedRelationship = this._super(...arguments);
-
+
// Customize relationship meta
normalizedRelationship.meta = camelCaseKeys(normalizedRelationship.meta);
-
+
return normalizedRelationship;
}
});
```
-
+
@since 1.13.0
@class JSONAPISerializer
@extends JSONSerializer
@@ -77188,30 +77188,30 @@ require('ember');
/**
Ember Data 2.0 Serializer:
-
+
In Ember Data a Serializer is used to serialize and deserialize
records when they are transferred in and out of an external source.
This process involves normalizing property names, transforming
attribute values and serializing relationships.
-
+
By default, Ember Data uses and recommends the `JSONAPISerializer`.
-
+
`JSONSerializer` is useful for simpler or legacy backends that may
not support the http://jsonapi.org/ spec.
-
+
For example, given the following `User` model and JSON payload:
-
+
```app/models/user.js
import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
-
+
export default Model.extend({
friends: hasMany('user'),
house: belongsTo('location'),
-
+
name: attr('string')
});
```
-
+
```js
{
id: 1,
@@ -77222,13 +77222,13 @@ require('ember');
}
}
```
-
+
`JSONSerializer` will normalize the JSON payload to the JSON API format that the
Ember Data store expects.
-
+
You can customize how JSONSerializer processes its payload by passing options in
the `attrs` hash or by subclassing the `JSONSerializer` and overriding hooks:
-
+
- To customize how a single record is normalized, use the `normalize` hook.
- To customize how `JSONSerializer` normalizes the whole server response, use the
`normalizeResponse` hook.
@@ -77236,9 +77236,9 @@ require('ember');
use one of the many specific `normalizeResponse` hooks.
- To customize how `JSONSerializer` normalizes your id, attributes or relationships,
use the `extractId`, `extractAttributes` and `extractRelationships` hooks.
-
+
The `JSONSerializer` normalization process follows these steps:
-
+
- `normalizeResponse` - entry method to the serializer.
- `normalizeCreateRecordResponse` - a `normalizeResponse` for a specific operation is called.
- `normalizeSingleResponse`|`normalizeArrayResponse` - for methods like `createRecord` we expect
@@ -77247,7 +77247,7 @@ require('ember');
calls it once. This is the method you most likely want to subclass.
- `extractId` | `extractAttributes` | `extractRelationships` - `normalize` delegates to these methods to
turn the record payload into the JSON API format.
-
+
@class JSONSerializer
@extends Serializer
*/
@@ -78580,42 +78580,42 @@ require('ember');
/**
Normally, applications will use the `RESTSerializer` by implementing
the `normalize` method.
-
+
This allows you to do whatever kind of munging you need and is
especially useful if your server is inconsistent and you need to
do munging differently for many different kinds of responses.
-
+
See the `normalize` documentation for more information.
-
+
## Across the Board Normalization
-
+
There are also a number of hooks that you might find useful to define
across-the-board rules for your payload. These rules will be useful
if your server is consistent, or if you're building an adapter for
an infrastructure service, like Firebase, and want to encode service
conventions.
-
+
For example, if all of your keys are underscored and all-caps, but
otherwise consistent with the names you use in your models, you
can implement across-the-board rules for how to convert an attribute
name in your model to a key in your JSON.
-
+
```app/serializers/application.js
import RESTSerializer from '@ember-data/serializer/rest';
import { underscore } from '@ember/string';
-
+
export default RESTSerializer.extend({
keyForAttribute(attr, method) {
return underscore(attr).toUpperCase();
}
});
```
-
+
You can also implement `keyForRelationship`, which takes the name
of the relationship as the first parameter, the kind of
relationship (`hasMany` or `belongsTo`) as the second parameter, and
the method (`serialize` or `deserialize`) as the third parameter.
-
+
@class RESTSerializer
@extends JSONSerializer
*/
@@ -79311,15 +79311,15 @@ require('ember');
/*
Assert that `addedRecord` has a valid type so it can be added to the
relationship of the `record`.
-
+
The assert basically checks if the `addedRecord` can be added to the
relationship (specified via `relationshipMeta`) of the `record`.
-
+
This utility should only be used internally, as both record parameters must
be an InternalModel and the `relationshipMeta` needs to be the meta
information about the relationship, retrieved via
`record.relationshipFor(key)`.
-
+
@method assertPolymorphicType
@param {InternalModel} internalModel
@param {RelationshipMeta} relationshipMeta retrieved via
@@ -90962,7 +90962,7 @@ require('ember');
/*
Configures a registry for use with an Ember-Data
store.
-
+
@method initializeStoreService
@param {Ember.ApplicationInstance | Ember.EngineInstance} instance
*/
@@ -91352,44 +91352,44 @@ require('ember');
Inflector.Ember provides a mechanism for supplying inflection rules for your
application. Ember includes a default set of inflection rules, and provides an
API for providing additional rules.
-
+
Examples:
-
+
Creating an inflector with no rules.
-
+
```js
var inflector = new Ember.Inflector();
```
-
+
Creating an inflector with the default ember ruleset.
-
+
```js
var inflector = new Ember.Inflector(Ember.Inflector.defaultRules);
-
+
inflector.pluralize('cow'); //=> 'kine'
inflector.singularize('kine'); //=> 'cow'
```
-
+
Creating an inflector and adding rules later.
-
+
```javascript
var inflector = Ember.Inflector.inflector;
-
+
inflector.pluralize('advice'); // => 'advices'
inflector.uncountable('advice');
inflector.pluralize('advice'); // => 'advice'
-
+
inflector.pluralize('formula'); // => 'formulas'
inflector.irregular('formula', 'formulae');
inflector.pluralize('formula'); // => 'formulae'
-
+
// you would not need to add these as they are the default rules
inflector.plural(/$/, 's');
inflector.singular(/s$/i, '');
```
-
+
Creating an inflector with a nondefault ruleset.
-
+
```javascript
var rules = {
plurals: [
@@ -91403,10 +91403,10 @@ require('ember');
],
uncountable: [ 'fish' ]
};
-
+
var inflector = new Ember.Inflector(rules);
```
-
+
@class Inflector
@namespace Ember
*/
diff --git a/packages/fastboot-express-middleware/test/fixtures/app-with-metadata/assets/vendor.map b/packages/fastboot-express-middleware/test/fixtures/app-with-metadata/assets/vendor.map
index f62ae0fa5..3f0bb6fa6 100644
--- a/packages/fastboot-express-middleware/test/fixtures/app-with-metadata/assets/vendor.map
+++ b/packages/fastboot-express-middleware/test/fixtures/app-with-metadata/assets/vendor.map
@@ -1 +1 @@
-{"version":3,"sources":["vendor/ember-cli/vendor-prefix.js","vendor/loader/loader.js","license.js","loader.js","@ember/-internals/browser-environment/index.js","@ember/-internals/console/index.js","@ember/-internals/container/index.js","@ember/-internals/environment/index.js","@ember/-internals/error-handling/index.js","@ember/-internals/extension-support/index.js","@ember/-internals/extension-support/lib/container_debug_adapter.js","@ember/-internals/extension-support/lib/data_adapter.js","@ember/-internals/glimmer/index.js","@ember/-internals/meta/index.js","@ember/-internals/meta/lib/meta.js","@ember/-internals/metal/index.js","@ember/-internals/owner/index.js","@ember/-internals/routing/index.js","@ember/-internals/routing/lib/ext/controller.js","@ember/-internals/routing/lib/location/api.js","@ember/-internals/routing/lib/location/auto_location.js","@ember/-internals/routing/lib/location/hash_location.js","@ember/-internals/routing/lib/location/history_location.js","@ember/-internals/routing/lib/location/none_location.js","@ember/-internals/routing/lib/location/util.js","@ember/-internals/routing/lib/services/router.js","@ember/-internals/routing/lib/services/routing.js","@ember/-internals/routing/lib/system/cache.js","@ember/-internals/routing/lib/system/controller_for.js","@ember/-internals/routing/lib/system/dsl.js","@ember/-internals/routing/lib/system/engines.js","@ember/-internals/routing/lib/system/generate_controller.js","@ember/-internals/routing/lib/system/query_params.js","@ember/-internals/routing/lib/system/route-info.js","@ember/-internals/routing/lib/system/route.js","@ember/-internals/routing/lib/system/router.js","@ember/-internals/routing/lib/system/router_state.js","@ember/-internals/routing/lib/system/transition.js","@ember/-internals/routing/lib/utils.js","@ember/-internals/runtime/index.js","@ember/-internals/runtime/lib/compare.js","@ember/-internals/runtime/lib/copy.js","@ember/-internals/runtime/lib/ext/function.js","@ember/-internals/runtime/lib/ext/rsvp.js","@ember/-internals/runtime/lib/is-equal.js","@ember/-internals/runtime/lib/mixins/-proxy.js","@ember/-internals/runtime/lib/mixins/action_handler.js","@ember/-internals/runtime/lib/mixins/array.js","@ember/-internals/runtime/lib/mixins/comparable.js","@ember/-internals/runtime/lib/mixins/container_proxy.js","@ember/-internals/runtime/lib/mixins/copyable.js","@ember/-internals/runtime/lib/mixins/enumerable.js","@ember/-internals/runtime/lib/mixins/evented.js","@ember/-internals/runtime/lib/mixins/mutable_enumerable.js","@ember/-internals/runtime/lib/mixins/observable.js","@ember/-internals/runtime/lib/mixins/promise_proxy.js","@ember/-internals/runtime/lib/mixins/registry_proxy.js","@ember/-internals/runtime/lib/mixins/target_action_support.js","@ember/-internals/runtime/lib/system/array_proxy.js","@ember/-internals/runtime/lib/system/core_object.js","@ember/-internals/runtime/lib/system/namespace.js","@ember/-internals/runtime/lib/system/object.js","@ember/-internals/runtime/lib/system/object_proxy.js","@ember/-internals/runtime/lib/type-of.js","@ember/-internals/utils/index.js","@ember/-internals/views/index.js","@ember/-internals/views/lib/compat/attrs.js","@ember/-internals/views/lib/compat/fallback-view-registry.js","@ember/-internals/views/lib/component_lookup.js","@ember/-internals/views/lib/mixins/action_support.js","@ember/-internals/views/lib/mixins/child_views_support.js","@ember/-internals/views/lib/mixins/class_names_support.js","@ember/-internals/views/lib/mixins/text_support.js","@ember/-internals/views/lib/mixins/view_state_support.js","@ember/-internals/views/lib/mixins/view_support.js","@ember/-internals/views/lib/system/action_manager.js","@ember/-internals/views/lib/system/event_dispatcher.js","@ember/-internals/views/lib/system/jquery.js","@ember/-internals/views/lib/system/jquery_event_deprecation.js","@ember/-internals/views/lib/system/utils.js","@ember/-internals/views/lib/views/core_view.js","@ember/-internals/views/lib/views/states.js","@ember/-internals/views/lib/views/states/default.js","@ember/-internals/views/lib/views/states/destroying.js","@ember/-internals/views/lib/views/states/has_element.js","@ember/-internals/views/lib/views/states/in_dom.js","@ember/-internals/views/lib/views/states/pre_render.js","@ember/application/globals-resolver.js","@ember/application/index.js","@ember/application/instance.js","@ember/application/lib/application.js","@ember/application/lib/lazy_load.js","@ember/canary-features/index.js","@ember/component/index.js","@ember/component/template-only.js","@ember/controller/index.js","@ember/controller/lib/controller_mixin.js","@ember/debug/index.js","@ember/debug/lib/capture-render-tree.js","@ember/debug/lib/deprecate.js","@ember/debug/lib/handlers.js","@ember/debug/lib/testing.js","@ember/debug/lib/warn.js","@ember/deprecated-features/index.js","@ember/engine/index.js","@ember/engine/instance.js","@ember/engine/lib/engine-parent.js","@ember/error/index.js","@ember/instrumentation/index.js","@ember/modifier/index.js","@ember/object/compat.js","@ember/object/computed.js","@ember/object/index.js","@ember/object/lib/computed/computed_macros.js","@ember/object/lib/computed/reduce_computed_macros.js","@ember/polyfills/index.js","@ember/polyfills/lib/assign.js","@ember/polyfills/lib/merge.js","@ember/polyfills/lib/weak_set.js","@ember/runloop/index.js","@ember/service/index.js","@ember/string/index.js","@ember/string/lib/string_registry.js","@glimmer/encoder.js","@glimmer/env.js","@glimmer/low-level.js","@glimmer/node.js","@glimmer/opcode-compiler.js","@glimmer/program.js","@glimmer/reference.js","@glimmer/runtime.js","@glimmer/util.js","@glimmer/validator.js","@glimmer/vm.js","@glimmer/wire-format.js","@simple-dom/document.js","backburner.js","dag-map.js","ember-babel.js","ember-testing/index.js","ember-testing/lib/adapters/adapter.js","ember-testing/lib/adapters/qunit.js","ember-testing/lib/events.js","ember-testing/lib/ext/application.js","ember-testing/lib/ext/rsvp.js","ember-testing/lib/helpers.js","ember-testing/lib/helpers/-is-form-control.js","ember-testing/lib/helpers/and_then.js","ember-testing/lib/helpers/click.js","ember-testing/lib/helpers/current_path.js","ember-testing/lib/helpers/current_route_name.js","ember-testing/lib/helpers/current_url.js","ember-testing/lib/helpers/fill_in.js","ember-testing/lib/helpers/find.js","ember-testing/lib/helpers/find_with_assert.js","ember-testing/lib/helpers/key_event.js","ember-testing/lib/helpers/pause_test.js","ember-testing/lib/helpers/trigger_event.js","ember-testing/lib/helpers/visit.js","ember-testing/lib/helpers/wait.js","ember-testing/lib/initializers.js","ember-testing/lib/setup_for_testing.js","ember-testing/lib/support.js","ember-testing/lib/test.js","ember-testing/lib/test/adapter.js","ember-testing/lib/test/helpers.js","ember-testing/lib/test/on_inject_helpers.js","ember-testing/lib/test/pending_requests.js","ember-testing/lib/test/promise.js","ember-testing/lib/test/run.js","ember-testing/lib/test/waiters.js","ember/index.js","ember/version.js","node-module/index.js","route-recognizer.js","router_js.js","rsvp.js","vendor/experimental-render-mode-rehydrate.js","addon-tree-output/@ember-data/adapter/-private.js","addon-tree-output/@ember-data/adapter/error.js","addon-tree-output/@ember-data/adapter/index.js","addon-tree-output/@ember-data/adapter/json-api.js","addon-tree-output/@ember-data/adapter/rest.js","addon-tree-output/@ember-data/canary-features/default-features.js","addon-tree-output/@ember-data/canary-features/index.js","addon-tree-output/@ember-data/debug/index.js","addon-tree-output/@ember-data/debug/setup.js","addon-tree-output/@ember-data/model/-private.js","addon-tree-output/@ember-data/model/index.js","addon-tree-output/@ember-data/private-build-infra/available-packages.js","addon-tree-output/@ember-data/private-build-infra/current-deprecations.js","addon-tree-output/@ember-data/private-build-infra/deprecations.js","addon-tree-output/@ember-data/private-build-infra/index.js","addon-tree-output/@ember-data/record-data/-private.js","addon-tree-output/@ember-data/serializer/-private.js","addon-tree-output/@ember-data/serializer/index.js","addon-tree-output/@ember-data/serializer/json-api.js","addon-tree-output/@ember-data/serializer/json.js","addon-tree-output/@ember-data/serializer/rest.js","addon-tree-output/@ember-data/serializer/transform.js","addon-tree-output/@ember-data/store/-debug/index.js","addon-tree-output/@ember-data/store/-private.js","addon-tree-output/@ember-data/store/index.js","addon-tree-output/@ember/ordered-set/index.js","addon-tree-output/@glimmer/component/-private/base-component-manager.js","addon-tree-output/@glimmer/component/-private/component.js","addon-tree-output/@glimmer/component/-private/destroyables.js","addon-tree-output/@glimmer/component/-private/ember-component-manager.js","addon-tree-output/@glimmer/component/-private/owner.js","addon-tree-output/@glimmer/component/index.js","addon-tree-output/ember-cli-app-version/initializer-factory.js","addon-tree-output/ember-cli-app-version/utils/regexp.js","addon-tree-output/ember-cli-fastboot/instance-initializers/clear-double-boot.js","addon-tree-output/ember-cli-fastboot/locations/none.js","addon-tree-output/ember-cli-fastboot/services/fastboot.js","addon-tree-output/ember-data/-private.js","addon-tree-output/ember-data/adapter.js","addon-tree-output/ember-data/adapters/errors.js","addon-tree-output/ember-data/adapters/json-api.js","addon-tree-output/ember-data/adapters/rest.js","addon-tree-output/ember-data/attr.js","addon-tree-output/ember-data/index.js","addon-tree-output/ember-data/initialize-store-service.js","addon-tree-output/ember-data/model.js","addon-tree-output/ember-data/relationships.js","addon-tree-output/ember-data/serializer.js","addon-tree-output/ember-data/serializers/embedded-records-mixin.js","addon-tree-output/ember-data/serializers/json-api.js","addon-tree-output/ember-data/serializers/json.js","addon-tree-output/ember-data/serializers/rest.js","addon-tree-output/ember-data/setup-container.js","addon-tree-output/ember-data/store.js","addon-tree-output/ember-data/transform.js","addon-tree-output/ember-data/version.js","addon-tree-output/ember-inflector/index.js","addon-tree-output/ember-inflector/lib/ext/string.js","addon-tree-output/ember-inflector/lib/helpers/pluralize.js","addon-tree-output/ember-inflector/lib/helpers/singularize.js","addon-tree-output/ember-inflector/lib/system.js","addon-tree-output/ember-inflector/lib/system/inflections.js","addon-tree-output/ember-inflector/lib/system/inflector.js","addon-tree-output/ember-inflector/lib/system/string.js","addon-tree-output/ember-inflector/lib/utils/make-helper.js","addon-tree-output/ember-load-initializers/index.js","addon-tree-output/ember-resolver/features.js","addon-tree-output/ember-resolver/index.js","addon-tree-output/ember-resolver/resolver.js","addon-tree-output/ember-resolver/resolvers/classic/container-debug-adapter.js","addon-tree-output/ember-resolver/resolvers/classic/index.js","addon-tree-output/ember-resolver/utils/class-factory.js","addon-tree-output/ember-test-waiters/build-waiter.js","addon-tree-output/ember-test-waiters/index.js","addon-tree-output/ember-test-waiters/noop-test-waiter.js","addon-tree-output/ember-test-waiters/test-waiter.js","addon-tree-output/ember-test-waiters/types/index.js","addon-tree-output/ember-test-waiters/wait-for-promise.js","addon-tree-output/ember-test-waiters/waiter-manager.js","addon-tree-output/ember-welcome-page/components/welcome-page.js","addon-tree-output/ember-welcome-page/templates/components/welcome-page.js","vendor/ember-cli/vendor-suffix.js"],"sourcesContent":["window.EmberENV = (function(EmberENV, extra) {\n for (var key in extra) {\n EmberENV[key] = extra[key];\n }\n\n return EmberENV;\n})(window.EmberENV || {}, {\"FEATURES\":{},\"EXTEND_PROTOTYPES\":{\"Date\":false},\"_APPLICATION_TEMPLATE_WRAPPER\":false,\"_DEFAULT_ASYNC_OBSERVERS\":true,\"_JQUERY_INTEGRATION\":false,\"_TEMPLATE_ONLY_GLIMMER_COMPONENTS\":true});\n\nvar runningTests = false;\n\n\n","var loader, define, requireModule, require, requirejs;\n\n(function (global) {\n 'use strict';\n\n function dict() {\n var obj = Object.create(null);\n obj['__'] = undefined;\n delete obj['__'];\n return obj;\n }\n\n // Save off the original values of these globals, so we can restore them if someone asks us to\n var oldGlobals = {\n loader: loader,\n define: define,\n requireModule: requireModule,\n require: require,\n requirejs: requirejs\n };\n\n requirejs = require = requireModule = function (id) {\n var pending = [];\n var mod = findModule(id, '(require)', pending);\n\n for (var i = pending.length - 1; i >= 0; i--) {\n pending[i].exports();\n }\n\n return mod.module.exports;\n };\n\n loader = {\n noConflict: function (aliases) {\n var oldName, newName;\n\n for (oldName in aliases) {\n if (aliases.hasOwnProperty(oldName)) {\n if (oldGlobals.hasOwnProperty(oldName)) {\n newName = aliases[oldName];\n\n global[newName] = global[oldName];\n global[oldName] = oldGlobals[oldName];\n }\n }\n }\n },\n // Option to enable or disable the generation of default exports\n makeDefaultExport: true\n };\n\n var registry = dict();\n var seen = dict();\n\n var uuid = 0;\n\n function unsupportedModule(length) {\n throw new Error('an unsupported module was defined, expected `define(id, deps, module)` instead got: `' + length + '` arguments to define`');\n }\n\n var defaultDeps = ['require', 'exports', 'module'];\n\n function Module(id, deps, callback, alias) {\n this.uuid = uuid++;\n this.id = id;\n this.deps = !deps.length && callback.length ? defaultDeps : deps;\n this.module = { exports: {} };\n this.callback = callback;\n this.hasExportsAsDep = false;\n this.isAlias = alias;\n this.reified = new Array(deps.length);\n\n /*\n Each module normally passes through these states, in order:\n new : initial state\n pending : this module is scheduled to be executed\n reifying : this module's dependencies are being executed\n reified : this module's dependencies finished executing successfully\n errored : this module's dependencies failed to execute\n finalized : this module executed successfully\n */\n this.state = 'new';\n }\n\n Module.prototype.makeDefaultExport = function () {\n var exports = this.module.exports;\n if (exports !== null && (typeof exports === 'object' || typeof exports === 'function') && exports['default'] === undefined && Object.isExtensible(exports)) {\n exports['default'] = exports;\n }\n };\n\n Module.prototype.exports = function () {\n // if finalized, there is no work to do. If reifying, there is a\n // circular dependency so we must return our (partial) exports.\n if (this.state === 'finalized' || this.state === 'reifying') {\n return this.module.exports;\n }\n\n\n if (loader.wrapModules) {\n this.callback = loader.wrapModules(this.id, this.callback);\n }\n\n this.reify();\n\n var result = this.callback.apply(this, this.reified);\n this.reified.length = 0;\n this.state = 'finalized';\n\n if (!(this.hasExportsAsDep && result === undefined)) {\n this.module.exports = result;\n }\n if (loader.makeDefaultExport) {\n this.makeDefaultExport();\n }\n return this.module.exports;\n };\n\n Module.prototype.unsee = function () {\n this.state = 'new';\n this.module = { exports: {} };\n };\n\n Module.prototype.reify = function () {\n if (this.state === 'reified') {\n return;\n }\n this.state = 'reifying';\n try {\n this.reified = this._reify();\n this.state = 'reified';\n } finally {\n if (this.state === 'reifying') {\n this.state = 'errored';\n }\n }\n };\n\n Module.prototype._reify = function () {\n var reified = this.reified.slice();\n for (var i = 0; i < reified.length; i++) {\n var mod = reified[i];\n reified[i] = mod.exports ? mod.exports : mod.module.exports();\n }\n return reified;\n };\n\n Module.prototype.findDeps = function (pending) {\n if (this.state !== 'new') {\n return;\n }\n\n this.state = 'pending';\n\n var deps = this.deps;\n\n for (var i = 0; i < deps.length; i++) {\n var dep = deps[i];\n var entry = this.reified[i] = { exports: undefined, module: undefined };\n if (dep === 'exports') {\n this.hasExportsAsDep = true;\n entry.exports = this.module.exports;\n } else if (dep === 'require') {\n entry.exports = this.makeRequire();\n } else if (dep === 'module') {\n entry.exports = this.module;\n } else {\n entry.module = findModule(resolve(dep, this.id), this.id, pending);\n }\n }\n };\n\n Module.prototype.makeRequire = function () {\n var id = this.id;\n var r = function (dep) {\n return require(resolve(dep, id));\n };\n r['default'] = r;\n r.moduleId = id;\n r.has = function (dep) {\n return has(resolve(dep, id));\n };\n return r;\n };\n\n define = function (id, deps, callback) {\n var module = registry[id];\n\n // If a module for this id has already been defined and is in any state\n // other than `new` (meaning it has been or is currently being required),\n // then we return early to avoid redefinition.\n if (module && module.state !== 'new') {\n return;\n }\n\n if (arguments.length < 2) {\n unsupportedModule(arguments.length);\n }\n\n if (!Array.isArray(deps)) {\n callback = deps;\n deps = [];\n }\n\n if (callback instanceof Alias) {\n registry[id] = new Module(callback.id, deps, callback, true);\n } else {\n registry[id] = new Module(id, deps, callback, false);\n }\n };\n\n define.exports = function (name, defaultExport) {\n var module = registry[name];\n\n // If a module for this name has already been defined and is in any state\n // other than `new` (meaning it has been or is currently being required),\n // then we return early to avoid redefinition.\n if (module && module.state !== 'new') {\n return;\n }\n\n module = new Module(name, [], noop, null);\n module.module.exports = defaultExport;\n module.state = 'finalized';\n registry[name] = module;\n\n return module;\n };\n\n function noop() {}\n // we don't support all of AMD\n // define.amd = {};\n\n function Alias(id) {\n this.id = id;\n }\n\n define.alias = function (id, target) {\n if (arguments.length === 2) {\n return define(target, new Alias(id));\n }\n\n return new Alias(id);\n };\n\n function missingModule(id, referrer) {\n throw new Error('Could not find module `' + id + '` imported from `' + referrer + '`');\n }\n\n function findModule(id, referrer, pending) {\n var mod = registry[id] || registry[id + '/index'];\n\n while (mod && mod.isAlias) {\n mod = registry[mod.id] || registry[mod.id + '/index'];\n }\n\n if (!mod) {\n missingModule(id, referrer);\n }\n\n if (pending && mod.state !== 'pending' && mod.state !== 'finalized') {\n mod.findDeps(pending);\n pending.push(mod);\n }\n return mod;\n }\n\n function resolve(child, id) {\n if (child.charAt(0) !== '.') {\n return child;\n }\n\n\n var parts = child.split('/');\n var nameParts = id.split('/');\n var parentBase = nameParts.slice(0, -1);\n\n for (var i = 0, l = parts.length; i < l; i++) {\n var part = parts[i];\n\n if (part === '..') {\n if (parentBase.length === 0) {\n throw new Error('Cannot access parent module of root');\n }\n parentBase.pop();\n } else if (part === '.') {\n continue;\n } else {\n parentBase.push(part);\n }\n }\n\n return parentBase.join('/');\n }\n\n function has(id) {\n return !!(registry[id] || registry[id + '/index']);\n }\n\n requirejs.entries = requirejs._eak_seen = registry;\n requirejs.has = has;\n requirejs.unsee = function (id) {\n findModule(id, '(unsee)', false).unsee();\n };\n\n requirejs.clear = function () {\n requirejs.entries = requirejs._eak_seen = registry = dict();\n seen = dict();\n };\n\n // This code primes the JS engine for good performance by warming the\n // JIT compiler for these functions.\n define('foo', function () {});\n define('foo/bar', [], function () {});\n define('foo/asdf', ['module', 'exports', 'require'], function (module, exports, require) {\n if (require.has('foo/bar')) {\n require('foo/bar');\n }\n });\n define('foo/baz', [], define.alias('foo'));\n define('foo/quz', define.alias('foo'));\n define.alias('foo', 'foo/qux');\n define('foo/bar', ['foo', './quz', './baz', './asdf', './bar', '../foo'], function () {});\n define('foo/main', ['foo/bar'], function () {});\n define.exports('foo/exports', {});\n\n require('foo/exports');\n require('foo/main');\n require.unsee('foo/bar');\n\n requirejs.clear();\n\n if (typeof exports === 'object' && typeof module === 'object' && module.exports) {\n module.exports = { require: require, define: define };\n }\n})(this);","/*!\n * @overview Ember - JavaScript Application Framework\n * @copyright Copyright 2011-2019 Tilde Inc. and contributors\n * Portions Copyright 2006-2011 Strobe Inc.\n * Portions Copyright 2008-2011 Apple Inc. All rights reserved.\n * @license Licensed under MIT license\n * See https://raw.github.com/emberjs/ember.js/master/LICENSE\n * @version 3.18.1\n */","/*globals process */\nvar define, require, Ember; // Used in @ember/-internals/environment/lib/global.js\n\n\nmainContext = this; // eslint-disable-line no-undef\n\n(function () {\n var registry;\n var seen;\n\n function missingModule(name, referrerName) {\n if (referrerName) {\n throw new Error('Could not find module ' + name + ' required by: ' + referrerName);\n } else {\n throw new Error('Could not find module ' + name);\n }\n }\n\n function internalRequire(_name, referrerName) {\n var name = _name;\n var mod = registry[name];\n\n if (!mod) {\n name = name + '/index';\n mod = registry[name];\n }\n\n var exports = seen[name];\n\n if (exports !== undefined) {\n return exports;\n }\n\n exports = seen[name] = {};\n\n if (!mod) {\n missingModule(_name, referrerName);\n }\n\n var deps = mod.deps;\n var callback = mod.callback;\n var reified = new Array(deps.length);\n\n for (var i = 0; i < deps.length; i++) {\n if (deps[i] === 'exports') {\n reified[i] = exports;\n } else if (deps[i] === 'require') {\n reified[i] = require;\n } else {\n reified[i] = internalRequire(deps[i], name);\n }\n }\n\n callback.apply(this, reified);\n return exports;\n }\n\n var isNode = typeof window === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n if (!isNode) {\n Ember = this.Ember = this.Ember || {};\n }\n\n if (typeof Ember === 'undefined') {\n Ember = {};\n }\n\n if (typeof Ember.__loader === 'undefined') {\n registry = Object.create(null);\n seen = Object.create(null);\n\n define = function (name, deps, callback) {\n var value = {};\n\n if (!callback) {\n value.deps = [];\n value.callback = deps;\n } else {\n value.deps = deps;\n value.callback = callback;\n }\n\n registry[name] = value;\n };\n\n require = function (name) {\n return internalRequire(name, null);\n }; // setup `require` module\n\n\n require['default'] = require;\n\n require.has = function registryHas(moduleName) {\n return Boolean(registry[moduleName]) || Boolean(registry[moduleName + '/index']);\n };\n\n require._eak_seen = registry;\n Ember.__loader = {\n define: define,\n require: require,\n registry: registry\n };\n } else {\n define = Ember.__loader.define;\n require = Ember.__loader.require;\n }\n})();","define(\"@ember/-internals/browser-environment/index\", [\"exports\"], function (_exports) {\n \"use strict\";\n\n Object.defineProperty(_exports, \"__esModule\", {\n value: true\n });\n _exports.hasDOM = _exports.isFirefox = _exports.isChrome = _exports.userAgent = _exports.history = _exports.location = _exports.window = void 0;\n // check if window exists and actually is the global\n var hasDom = typeof self === 'object' && self !== null && self.Object === Object && typeof Window !== 'undefined' && self.constructor === Window && typeof document === 'object' && document !== null && self.document === document && typeof location === 'object' && location !== null && self.location === location && typeof history === 'object' && history !== null && self.history === history && typeof navigator === 'object' && navigator !== null && self.navigator === navigator && typeof navigator.userAgent === 'string';\n _exports.hasDOM = hasDom;\n var window = hasDom ? self : null;\n _exports.window = window;\n var location$1 = hasDom ? self.location : null;\n _exports.location = location$1;\n var history$1 = hasDom ? self.history : null;\n _exports.history = history$1;\n var userAgent = hasDom ? self.navigator.userAgent : 'Lynx (textmode)';\n _exports.userAgent = userAgent;\n var isChrome = hasDom ? Boolean(window.chrome) && !window.opera : false;\n _exports.isChrome = isChrome;\n var isFirefox = hasDom ? typeof InstallTrigger !== 'undefined' : false;\n _exports.isFirefox = isFirefox;\n});","define(\"@ember/-internals/console/index\", [\"exports\", \"@ember/debug\", \"@ember/deprecated-features\"], function (_exports, _debug, _deprecatedFeatures) {\n \"use strict\";\n\n Object.defineProperty(_exports, \"__esModule\", {\n value: true\n });\n _exports.default = void 0;\n // Deliver message that the function is deprecated\n var DEPRECATION_MESSAGE = 'Use of Ember.Logger is deprecated. Please use `console` for logging.';\n var DEPRECATION_ID = 'ember-console.deprecate-logger';\n var DEPRECATION_URL = 'https://emberjs.com/deprecations/v3.x#toc_use-console-rather-than-ember-logger';\n /**\n @module ember\n */\n\n /**\n Inside Ember-Metal, simply uses the methods from `imports.console`.\n Override this to provide more robust logging functionality.\n \n @class Logger\n @deprecated Use 'console' instead\n \n @namespace Ember\n @public\n */\n\n var DEPRECATED_LOGGER;\n\n if (_deprecatedFeatures.LOGGER) {\n DEPRECATED_LOGGER = {\n /**\n Logs the arguments to the console.\n You can pass as many arguments as you want and they will be joined together with a space.\n ```javascript\n var foo = 1;\n Ember.Logger.log('log value of foo:', foo);\n // \"log value of foo: 1\" will be printed to the console\n ```\n @method log\n @for Ember.Logger\n @param {*} arguments\n @public\n */\n log() {\n (true && !(false) && (0, _debug.deprecate)(DEPRECATION_MESSAGE, false, {\n id: DEPRECATION_ID,\n until: '4.0.0',\n url: DEPRECATION_URL\n }));\n return console.log(...arguments); // eslint-disable-line no-console\n },\n\n /**\n Prints the arguments to the console with a warning icon.\n You can pass as many arguments as you want and they will be joined together with a space.\n ```javascript\n Ember.Logger.warn('Something happened!');\n // \"Something happened!\" will be printed to the console with a warning icon.\n ```\n @method warn\n @for Ember.Logger\n @param {*} arguments\n @public\n */\n warn() {\n (true && !(false) && (0, _debug.deprecate)(DEPRECATION_MESSAGE, false, {\n id: DEPRECATION_ID,\n until: '4.0.0',\n url: DEPRECATION_URL\n }));\n return console.warn(...arguments); // eslint-disable-line no-console\n },\n\n /**\n Prints the arguments to the console with an error icon, red text and a stack trace.\n You can pass as many arguments as you want and they will be joined together with a space.\n ```javascript\n Ember.Logger.error('Danger! Danger!');\n // \"Danger! Danger!\" will be printed to the console in red text.\n ```\n @method error\n @for Ember.Logger\n @param {*} arguments\n @public\n */\n error() {\n (true && !(false) && (0, _debug.deprecate)(DEPRECATION_MESSAGE, false, {\n id: DEPRECATION_ID,\n until: '4.0.0',\n url: DEPRECATION_URL\n }));\n return console.error(...arguments); // eslint-disable-line no-console\n },\n\n /**\n Logs the arguments to the console.\n You can pass as many arguments as you want and they will be joined together with a space.\n ```javascript\n var foo = 1;\n Ember.Logger.info('log value of foo:', foo);\n // \"log value of foo: 1\" will be printed to the console\n ```\n @method info\n @for Ember.Logger\n @param {*} arguments\n @public\n */\n info() {\n (true && !(false) && (0, _debug.deprecate)(DEPRECATION_MESSAGE, false, {\n id: DEPRECATION_ID,\n until: '4.0.0',\n url: DEPRECATION_URL\n }));\n return console.info(...arguments); // eslint-disable-line no-console\n },\n\n /**\n Logs the arguments to the console in blue text.\n You can pass as many arguments as you want and they will be joined together with a space.\n ```javascript\n var foo = 1;\n Ember.Logger.debug('log value of foo:', foo);\n // \"log value of foo: 1\" will be printed to the console\n ```\n @method debug\n @for Ember.Logger\n @param {*} arguments\n @public\n */\n debug() {\n (true && !(false) && (0, _debug.deprecate)(DEPRECATION_MESSAGE, false, {\n id: DEPRECATION_ID,\n until: '4.0.0',\n url: DEPRECATION_URL\n }));\n /* eslint-disable no-console */\n\n if (console.debug) {\n return console.debug(...arguments);\n }\n\n return console.info(...arguments);\n /* eslint-enable no-console */\n },\n\n /**\n If the value passed into `Ember.Logger.assert` is not truthy it will throw an error with a stack trace.\n ```javascript\n Ember.Logger.assert(true); // undefined\n Ember.Logger.assert(true === false); // Throws an Assertion failed error.\n Ember.Logger.assert(true === false, 'Something invalid'); // Throws an Assertion failed error with message.\n ```\n @method assert\n @for Ember.Logger\n @param {Boolean} bool Value to test\n @param {String} message Assertion message on failed\n @public\n */\n assert() {\n (true && !(false) && (0, _debug.deprecate)(DEPRECATION_MESSAGE, false, {\n id: DEPRECATION_ID,\n until: '4.0.0',\n url: DEPRECATION_URL\n }));\n return console.assert(...arguments); // eslint-disable-line no-console\n }\n\n };\n }\n\n var _default = DEPRECATED_LOGGER;\n _exports.default = _default;\n});","define(\"@ember/-internals/container/index\", [\"exports\", \"@ember/-internals/owner\", \"@ember/-internals/utils\", \"@ember/debug\", \"@ember/polyfills\"], function (_exports, _owner, _utils, _debug, _polyfills) {\n \"use strict\";\n\n Object.defineProperty(_exports, \"__esModule\", {\n value: true\n });\n _exports.privatize = privatize;\n _exports.FACTORY_FOR = _exports.Container = _exports.Registry = void 0;\n var leakTracking;\n var containers;\n\n if (true\n /* DEBUG */\n ) {\n // requires v8\n // chrome --js-flags=\"--allow-natives-syntax --expose-gc\"\n // node --allow-natives-syntax --expose-gc\n try {\n if (typeof gc === 'function') {\n leakTracking = (() => {\n // avoid syntax errors when --allow-natives-syntax not present\n var GetWeakSetValues = new Function('weakSet', 'return %GetWeakSetValues(weakSet, 0)');\n containers = new WeakSet();\n return {\n hasContainers() {\n gc();\n return GetWeakSetValues(containers).length > 0;\n },\n\n reset() {\n var values = GetWeakSetValues(containers);\n\n for (var i = 0; i < values.length; i++) {\n containers.delete(values[i]);\n }\n }\n\n };\n })();\n }\n } catch (e) {// ignore\n }\n }\n /**\n A container used to instantiate and cache objects.\n \n Every `Container` must be associated with a `Registry`, which is referenced\n to determine the factory and options that should be used to instantiate\n objects.\n \n The public API for `Container` is still in flux and should not be considered\n stable.\n \n @private\n @class Container\n */\n\n\n class Container {\n constructor(registry, options = {}) {\n this.registry = registry;\n this.owner = options.owner || null;\n this.cache = (0, _utils.dictionary)(options.cache || null);\n this.factoryManagerCache = (0, _utils.dictionary)(options.factoryManagerCache || null);\n this.isDestroyed = false;\n this.isDestroying = false;\n\n if (true\n /* DEBUG */\n ) {\n this.validationCache = (0, _utils.dictionary)(options.validationCache || null);\n\n if (containers !== undefined) {\n containers.add(this);\n }\n }\n }\n /**\n @private\n @property registry\n @type Registry\n @since 1.11.0\n */\n\n /**\n @private\n @property cache\n @type InheritingDict\n */\n\n /**\n @private\n @property validationCache\n @type InheritingDict\n */\n\n /**\n Given a fullName return a corresponding instance.\n The default behavior is for lookup to return a singleton instance.\n The singleton is scoped to the container, allowing multiple containers\n to all have their own locally scoped singletons.\n ```javascript\n let registry = new Registry();\n let container = registry.container();\n registry.register('api:twitter', Twitter);\n let twitter = container.lookup('api:twitter');\n twitter instanceof Twitter; // => true\n // by default the container will return singletons\n let twitter2 = container.lookup('api:twitter');\n twitter2 instanceof Twitter; // => true\n twitter === twitter2; //=> true\n ```\n If singletons are not wanted, an optional flag can be provided at lookup.\n ```javascript\n let registry = new Registry();\n let container = registry.container();\n registry.register('api:twitter', Twitter);\n let twitter = container.lookup('api:twitter', { singleton: false });\n let twitter2 = container.lookup('api:twitter', { singleton: false });\n twitter === twitter2; //=> false\n ```\n @private\n @method lookup\n @param {String} fullName\n @param {Object} [options]\n @param {String} [options.source] The fullname of the request source (used for local lookup)\n @return {any}\n */\n\n\n lookup(fullName, options) {\n if (this.isDestroyed) {\n throw new Error(`Can not call \\`.lookup\\` after the owner has been destroyed`);\n }\n\n (true && !(this.registry.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.registry.isValidFullName(fullName)));\n return lookup(this, this.registry.normalize(fullName), options);\n }\n /**\n A depth first traversal, destroying the container, its descendant containers and all\n their managed objects.\n @private\n @method destroy\n */\n\n\n destroy() {\n this.isDestroying = true;\n destroyDestroyables(this);\n }\n\n finalizeDestroy() {\n resetCache(this);\n this.isDestroyed = true;\n }\n /**\n Clear either the entire cache or just the cache for a particular key.\n @private\n @method reset\n @param {String} fullName optional key to reset; if missing, resets everything\n */\n\n\n reset(fullName) {\n if (this.isDestroyed) return;\n\n if (fullName === undefined) {\n destroyDestroyables(this);\n resetCache(this);\n } else {\n resetMember(this, this.registry.normalize(fullName));\n }\n }\n /**\n Returns an object that can be used to provide an owner to a\n manually created instance.\n @private\n @method ownerInjection\n @returns { Object }\n */\n\n\n ownerInjection() {\n return {\n [_owner.OWNER]: this.owner\n };\n }\n /**\n Given a fullName, return the corresponding factory. The consumer of the factory\n is responsible for the destruction of any factory instances, as there is no\n way for the container to ensure instances are destroyed when it itself is\n destroyed.\n @public\n @method factoryFor\n @param {String} fullName\n @param {Object} [options]\n @param {String} [options.source] The fullname of the request source (used for local lookup)\n @return {any}\n */\n\n\n factoryFor(fullName, options = {}) {\n if (this.isDestroyed) {\n throw new Error(`Can not call \\`.factoryFor\\` after the owner has been destroyed`);\n }\n\n var normalizedName = this.registry.normalize(fullName);\n (true && !(this.registry.isValidFullName(normalizedName)) && (0, _debug.assert)('fullName must be a proper full name', this.registry.isValidFullName(normalizedName)));\n (true && !(false\n /* EMBER_MODULE_UNIFICATION */\n || !options.namespace) && (0, _debug.assert)('EMBER_MODULE_UNIFICATION must be enabled to pass a namespace option to factoryFor', false || !options.namespace));\n\n if (options.source || options.namespace) {\n normalizedName = this.registry.expandLocalLookup(fullName, options);\n\n if (!normalizedName) {\n return;\n }\n }\n\n return factoryFor(this, normalizedName, fullName);\n }\n\n }\n\n _exports.Container = Container;\n\n if (true\n /* DEBUG */\n ) {\n Container._leakTracking = leakTracking;\n }\n /*\n * Wrap a factory manager in a proxy which will not permit properties to be\n * set on the manager.\n */\n\n\n function wrapManagerInDeprecationProxy(manager) {\n if (_utils.HAS_NATIVE_PROXY) {\n var validator = {\n set(_obj, prop) {\n throw new Error(`You attempted to set \"${prop}\" on a factory manager created by container#factoryFor. A factory manager is a read-only construct.`);\n }\n\n }; // Note:\n // We have to proxy access to the manager here so that private property\n // access doesn't cause the above errors to occur.\n\n var m = manager;\n var proxiedManager = {\n class: m.class,\n\n create(props) {\n return m.create(props);\n }\n\n };\n var proxy = new Proxy(proxiedManager, validator);\n FACTORY_FOR.set(proxy, manager);\n }\n\n return manager;\n }\n\n function isSingleton(container, fullName) {\n return container.registry.getOption(fullName, 'singleton') !== false;\n }\n\n function isInstantiatable(container, fullName) {\n return container.registry.getOption(fullName, 'instantiate') !== false;\n }\n\n function lookup(container, fullName, options = {}) {\n (true && !(false\n /* EMBER_MODULE_UNIFICATION */\n || !options.namespace) && (0, _debug.assert)('EMBER_MODULE_UNIFICATION must be enabled to pass a namespace option to lookup', false || !options.namespace));\n var normalizedName = fullName;\n\n if (options.source || options.namespace) {\n normalizedName = container.registry.expandLocalLookup(fullName, options);\n\n if (!normalizedName) {\n return;\n }\n }\n\n if (options.singleton !== false) {\n var cached = container.cache[normalizedName];\n\n if (cached !== undefined) {\n return cached;\n }\n }\n\n return instantiateFactory(container, normalizedName, fullName, options);\n }\n\n function factoryFor(container, normalizedName, fullName) {\n var cached = container.factoryManagerCache[normalizedName];\n\n if (cached !== undefined) {\n return cached;\n }\n\n var factory = container.registry.resolve(normalizedName);\n\n if (factory === undefined) {\n return;\n }\n\n if (true\n /* DEBUG */\n && factory && typeof factory._onLookup === 'function') {\n factory._onLookup(fullName);\n }\n\n var manager = new FactoryManager(container, factory, fullName, normalizedName);\n\n if (true\n /* DEBUG */\n ) {\n manager = wrapManagerInDeprecationProxy(manager);\n }\n\n container.factoryManagerCache[normalizedName] = manager;\n return manager;\n }\n\n function isSingletonClass(container, fullName, {\n instantiate,\n singleton\n }) {\n return singleton !== false && !instantiate && isSingleton(container, fullName) && !isInstantiatable(container, fullName);\n }\n\n function isSingletonInstance(container, fullName, {\n instantiate,\n singleton\n }) {\n return singleton !== false && instantiate !== false && isSingleton(container, fullName) && isInstantiatable(container, fullName);\n }\n\n function isFactoryClass(container, fullname, {\n instantiate,\n singleton\n }) {\n return instantiate === false && (singleton === false || !isSingleton(container, fullname)) && !isInstantiatable(container, fullname);\n }\n\n function isFactoryInstance(container, fullName, {\n instantiate,\n singleton\n }) {\n return instantiate !== false && (singleton !== false || isSingleton(container, fullName)) && isInstantiatable(container, fullName);\n }\n\n function instantiateFactory(container, normalizedName, fullName, options) {\n var factoryManager = factoryFor(container, normalizedName, fullName);\n\n if (factoryManager === undefined) {\n return;\n } // SomeClass { singleton: true, instantiate: true } | { singleton: true } | { instantiate: true } | {}\n // By default majority of objects fall into this case\n\n\n if (isSingletonInstance(container, fullName, options)) {\n var instance = container.cache[normalizedName] = factoryManager.create(); // if this lookup happened _during_ destruction (emits a deprecation, but\n // is still possible) ensure that it gets destroyed\n\n if (container.isDestroying) {\n if (typeof instance.destroy === 'function') {\n instance.destroy();\n }\n }\n\n return instance;\n } // SomeClass { singleton: false, instantiate: true }\n\n\n if (isFactoryInstance(container, fullName, options)) {\n return factoryManager.create();\n } // SomeClass { singleton: true, instantiate: false } | { instantiate: false } | { singleton: false, instantiation: false }\n\n\n if (isSingletonClass(container, fullName, options) || isFactoryClass(container, fullName, options)) {\n return factoryManager.class;\n }\n\n throw new Error('Could not create factory');\n }\n\n function processInjections(container, injections, result) {\n if (true\n /* DEBUG */\n ) {\n container.registry.validateInjections(injections);\n }\n\n var hash = result.injections;\n\n if (hash === undefined) {\n hash = result.injections = {};\n }\n\n for (var i = 0; i < injections.length; i++) {\n var {\n property,\n specifier,\n source\n } = injections[i];\n\n if (source) {\n hash[property] = lookup(container, specifier, {\n source\n });\n } else {\n hash[property] = lookup(container, specifier);\n }\n\n if (!result.isDynamic) {\n result.isDynamic = !isSingleton(container, specifier);\n }\n }\n }\n\n function buildInjections(container, typeInjections, injections) {\n var result = {\n injections: undefined,\n isDynamic: false\n };\n\n if (typeInjections !== undefined) {\n processInjections(container, typeInjections, result);\n }\n\n if (injections !== undefined) {\n processInjections(container, injections, result);\n }\n\n return result;\n }\n\n function injectionsFor(container, fullName) {\n var registry = container.registry;\n var [type] = fullName.split(':');\n var typeInjections = registry.getTypeInjections(type);\n var injections = registry.getInjections(fullName);\n return buildInjections(container, typeInjections, injections);\n }\n\n function destroyDestroyables(container) {\n var cache = container.cache;\n var keys = Object.keys(cache);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = cache[key];\n\n if (value.destroy) {\n value.destroy();\n }\n }\n }\n\n function resetCache(container) {\n container.cache = (0, _utils.dictionary)(null);\n container.factoryManagerCache = (0, _utils.dictionary)(null);\n }\n\n function resetMember(container, fullName) {\n var member = container.cache[fullName];\n delete container.factoryManagerCache[fullName];\n\n if (member) {\n delete container.cache[fullName];\n\n if (member.destroy) {\n member.destroy();\n }\n }\n }\n\n var FACTORY_FOR = new WeakMap();\n _exports.FACTORY_FOR = FACTORY_FOR;\n\n class FactoryManager {\n constructor(container, factory, fullName, normalizedName) {\n this.container = container;\n this.owner = container.owner;\n this.class = factory;\n this.fullName = fullName;\n this.normalizedName = normalizedName;\n this.madeToString = undefined;\n this.injections = undefined;\n FACTORY_FOR.set(this, this);\n }\n\n toString() {\n if (this.madeToString === undefined) {\n this.madeToString = this.container.registry.makeToString(this.class, this.fullName);\n }\n\n return this.madeToString;\n }\n\n create(options) {\n var {\n container\n } = this;\n\n if (container.isDestroyed) {\n throw new Error(`Can not create new instances after the owner has been destroyed (you attempted to create ${this.fullName})`);\n }\n\n var injectionsCache = this.injections;\n\n if (injectionsCache === undefined) {\n var {\n injections,\n isDynamic\n } = injectionsFor(this.container, this.normalizedName);\n injectionsCache = injections;\n\n if (!isDynamic) {\n this.injections = injections;\n }\n }\n\n var props = injectionsCache;\n\n if (options !== undefined) {\n props = (0, _polyfills.assign)({}, injectionsCache, options);\n }\n\n if (true\n /* DEBUG */\n ) {\n var lazyInjections;\n var validationCache = this.container.validationCache; // Ensure that all lazy injections are valid at instantiation time\n\n if (!validationCache[this.fullName] && this.class && typeof this.class._lazyInjections === 'function') {\n lazyInjections = this.class._lazyInjections();\n lazyInjections = this.container.registry.normalizeInjectionsHash(lazyInjections);\n this.container.registry.validateInjections(lazyInjections);\n }\n\n validationCache[this.fullName] = true;\n }\n\n if (!this.class.create) {\n throw new Error(`Failed to create an instance of '${this.normalizedName}'. Most likely an improperly defined class or an invalid module export.`);\n } // required to allow access to things like\n // the customized toString, _debugContainerKey,\n // owner, etc. without a double extend and without\n // modifying the objects properties\n\n\n if (typeof this.class._initFactory === 'function') {\n this.class._initFactory(this);\n } else {\n // in the non-EmberObject case we need to still setOwner\n // this is required for supporting glimmer environment and\n // template instantiation which rely heavily on\n // `options[OWNER]` being passed into `create`\n // TODO: clean this up, and remove in future versions\n if (options === undefined || props === undefined) {\n // avoid mutating `props` here since they are the cached injections\n props = (0, _polyfills.assign)({}, props);\n }\n\n (0, _owner.setOwner)(props, this.owner);\n }\n\n var instance = this.class.create(props);\n FACTORY_FOR.set(instance, this);\n return instance;\n }\n\n }\n\n var VALID_FULL_NAME_REGEXP = /^[^:]+:[^:]+$/;\n /**\n A registry used to store factory and option information keyed\n by type.\n \n A `Registry` stores the factory and option information needed by a\n `Container` to instantiate and cache objects.\n \n The API for `Registry` is still in flux and should not be considered stable.\n \n @private\n @class Registry\n @since 1.11.0\n */\n\n class Registry {\n constructor(options = {}) {\n this.fallback = options.fallback || null;\n this.resolver = options.resolver || null;\n this.registrations = (0, _utils.dictionary)(options.registrations || null);\n this._typeInjections = (0, _utils.dictionary)(null);\n this._injections = (0, _utils.dictionary)(null);\n this._localLookupCache = Object.create(null);\n this._normalizeCache = (0, _utils.dictionary)(null);\n this._resolveCache = (0, _utils.dictionary)(null);\n this._failSet = new Set();\n this._options = (0, _utils.dictionary)(null);\n this._typeOptions = (0, _utils.dictionary)(null);\n }\n /**\n A backup registry for resolving registrations when no matches can be found.\n @private\n @property fallback\n @type Registry\n */\n\n /**\n An object that has a `resolve` method that resolves a name.\n @private\n @property resolver\n @type Resolver\n */\n\n /**\n @private\n @property registrations\n @type InheritingDict\n */\n\n /**\n @private\n @property _typeInjections\n @type InheritingDict\n */\n\n /**\n @private\n @property _injections\n @type InheritingDict\n */\n\n /**\n @private\n @property _normalizeCache\n @type InheritingDict\n */\n\n /**\n @private\n @property _resolveCache\n @type InheritingDict\n */\n\n /**\n @private\n @property _options\n @type InheritingDict\n */\n\n /**\n @private\n @property _typeOptions\n @type InheritingDict\n */\n\n /**\n Creates a container based on this registry.\n @private\n @method container\n @param {Object} options\n @return {Container} created container\n */\n\n\n container(options) {\n return new Container(this, options);\n }\n /**\n Registers a factory for later injection.\n Example:\n ```javascript\n let registry = new Registry();\n registry.register('model:user', Person, {singleton: false });\n registry.register('fruit:favorite', Orange);\n registry.register('communication:main', Email, {singleton: false});\n ```\n @private\n @method register\n @param {String} fullName\n @param {Function} factory\n @param {Object} options\n */\n\n\n register(fullName, factory, options = {}) {\n (true && !(this.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.isValidFullName(fullName)));\n (true && !(factory !== undefined) && (0, _debug.assert)(`Attempting to register an unknown factory: '${fullName}'`, factory !== undefined));\n var normalizedName = this.normalize(fullName);\n (true && !(!this._resolveCache[normalizedName]) && (0, _debug.assert)(`Cannot re-register: '${fullName}', as it has already been resolved.`, !this._resolveCache[normalizedName]));\n\n this._failSet.delete(normalizedName);\n\n this.registrations[normalizedName] = factory;\n this._options[normalizedName] = options;\n }\n /**\n Unregister a fullName\n ```javascript\n let registry = new Registry();\n registry.register('model:user', User);\n registry.resolve('model:user').create() instanceof User //=> true\n registry.unregister('model:user')\n registry.resolve('model:user') === undefined //=> true\n ```\n @private\n @method unregister\n @param {String} fullName\n */\n\n\n unregister(fullName) {\n (true && !(this.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.isValidFullName(fullName)));\n var normalizedName = this.normalize(fullName);\n this._localLookupCache = Object.create(null);\n delete this.registrations[normalizedName];\n delete this._resolveCache[normalizedName];\n delete this._options[normalizedName];\n\n this._failSet.delete(normalizedName);\n }\n /**\n Given a fullName return the corresponding factory.\n By default `resolve` will retrieve the factory from\n the registry.\n ```javascript\n let registry = new Registry();\n registry.register('api:twitter', Twitter);\n registry.resolve('api:twitter') // => Twitter\n ```\n Optionally the registry can be provided with a custom resolver.\n If provided, `resolve` will first provide the custom resolver\n the opportunity to resolve the fullName, otherwise it will fallback\n to the registry.\n ```javascript\n let registry = new Registry();\n registry.resolver = function(fullName) {\n // lookup via the module system of choice\n };\n // the twitter factory is added to the module system\n registry.resolve('api:twitter') // => Twitter\n ```\n @private\n @method resolve\n @param {String} fullName\n @param {Object} [options]\n @param {String} [options.source] the fullname of the request source (used for local lookups)\n @return {Function} fullName's factory\n */\n\n\n resolve(fullName, options) {\n var factory = resolve(this, this.normalize(fullName), options);\n\n if (factory === undefined && this.fallback !== null) {\n factory = this.fallback.resolve(...arguments);\n }\n\n return factory;\n }\n /**\n A hook that can be used to describe how the resolver will\n attempt to find the factory.\n For example, the default Ember `.describe` returns the full\n class name (including namespace) where Ember's resolver expects\n to find the `fullName`.\n @private\n @method describe\n @param {String} fullName\n @return {string} described fullName\n */\n\n\n describe(fullName) {\n if (this.resolver !== null && this.resolver.lookupDescription) {\n return this.resolver.lookupDescription(fullName);\n } else if (this.fallback !== null) {\n return this.fallback.describe(fullName);\n } else {\n return fullName;\n }\n }\n /**\n A hook to enable custom fullName normalization behavior\n @private\n @method normalizeFullName\n @param {String} fullName\n @return {string} normalized fullName\n */\n\n\n normalizeFullName(fullName) {\n if (this.resolver !== null && this.resolver.normalize) {\n return this.resolver.normalize(fullName);\n } else if (this.fallback !== null) {\n return this.fallback.normalizeFullName(fullName);\n } else {\n return fullName;\n }\n }\n /**\n Normalize a fullName based on the application's conventions\n @private\n @method normalize\n @param {String} fullName\n @return {string} normalized fullName\n */\n\n\n normalize(fullName) {\n return this._normalizeCache[fullName] || (this._normalizeCache[fullName] = this.normalizeFullName(fullName));\n }\n /**\n @method makeToString\n @private\n @param {any} factory\n @param {string} fullName\n @return {function} toString function\n */\n\n\n makeToString(factory, fullName) {\n if (this.resolver !== null && this.resolver.makeToString) {\n return this.resolver.makeToString(factory, fullName);\n } else if (this.fallback !== null) {\n return this.fallback.makeToString(factory, fullName);\n } else {\n return factory.toString();\n }\n }\n /**\n Given a fullName check if the container is aware of its factory\n or singleton instance.\n @private\n @method has\n @param {String} fullName\n @param {Object} [options]\n @param {String} [options.source] the fullname of the request source (used for local lookups)\n @return {Boolean}\n */\n\n\n has(fullName, options) {\n if (!this.isValidFullName(fullName)) {\n return false;\n }\n\n var source = options && options.source && this.normalize(options.source);\n var namespace = options && options.namespace || undefined;\n return has(this, this.normalize(fullName), source, namespace);\n }\n /**\n Allow registering options for all factories of a type.\n ```javascript\n let registry = new Registry();\n let container = registry.container();\n // if all of type `connection` must not be singletons\n registry.optionsForType('connection', { singleton: false });\n registry.register('connection:twitter', TwitterConnection);\n registry.register('connection:facebook', FacebookConnection);\n let twitter = container.lookup('connection:twitter');\n let twitter2 = container.lookup('connection:twitter');\n twitter === twitter2; // => false\n let facebook = container.lookup('connection:facebook');\n let facebook2 = container.lookup('connection:facebook');\n facebook === facebook2; // => false\n ```\n @private\n @method optionsForType\n @param {String} type\n @param {Object} options\n */\n\n\n optionsForType(type, options) {\n this._typeOptions[type] = options;\n }\n\n getOptionsForType(type) {\n var optionsForType = this._typeOptions[type];\n\n if (optionsForType === undefined && this.fallback !== null) {\n optionsForType = this.fallback.getOptionsForType(type);\n }\n\n return optionsForType;\n }\n /**\n @private\n @method options\n @param {String} fullName\n @param {Object} options\n */\n\n\n options(fullName, options) {\n var normalizedName = this.normalize(fullName);\n this._options[normalizedName] = options;\n }\n\n getOptions(fullName) {\n var normalizedName = this.normalize(fullName);\n var options = this._options[normalizedName];\n\n if (options === undefined && this.fallback !== null) {\n options = this.fallback.getOptions(fullName);\n }\n\n return options;\n }\n\n getOption(fullName, optionName) {\n var options = this._options[fullName];\n\n if (options !== undefined && options[optionName] !== undefined) {\n return options[optionName];\n }\n\n var type = fullName.split(':')[0];\n options = this._typeOptions[type];\n\n if (options && options[optionName] !== undefined) {\n return options[optionName];\n } else if (this.fallback !== null) {\n return this.fallback.getOption(fullName, optionName);\n }\n\n return undefined;\n }\n /**\n Used only via `injection`.\n Provides a specialized form of injection, specifically enabling\n all objects of one type to be injected with a reference to another\n object.\n For example, provided each object of type `controller` needed a `router`.\n one would do the following:\n ```javascript\n let registry = new Registry();\n let container = registry.container();\n registry.register('router:main', Router);\n registry.register('controller:user', UserController);\n registry.register('controller:post', PostController);\n registry.typeInjection('controller', 'router', 'router:main');\n let user = container.lookup('controller:user');\n let post = container.lookup('controller:post');\n user.router instanceof Router; //=> true\n post.router instanceof Router; //=> true\n // both controllers share the same router\n user.router === post.router; //=> true\n ```\n @private\n @method typeInjection\n @param {String} type\n @param {String} property\n @param {String} fullName\n */\n\n\n typeInjection(type, property, fullName) {\n (true && !(this.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.isValidFullName(fullName)));\n var fullNameType = fullName.split(':')[0];\n (true && !(fullNameType !== type) && (0, _debug.assert)(`Cannot inject a '${fullName}' on other ${type}(s).`, fullNameType !== type));\n var injections = this._typeInjections[type] || (this._typeInjections[type] = []);\n injections.push({\n property,\n specifier: fullName\n });\n }\n /**\n Defines injection rules.\n These rules are used to inject dependencies onto objects when they\n are instantiated.\n Two forms of injections are possible:\n * Injecting one fullName on another fullName\n * Injecting one fullName on a type\n Example:\n ```javascript\n let registry = new Registry();\n let container = registry.container();\n registry.register('source:main', Source);\n registry.register('model:user', User);\n registry.register('model:post', Post);\n // injecting one fullName on another fullName\n // eg. each user model gets a post model\n registry.injection('model:user', 'post', 'model:post');\n // injecting one fullName on another type\n registry.injection('model', 'source', 'source:main');\n let user = container.lookup('model:user');\n let post = container.lookup('model:post');\n user.source instanceof Source; //=> true\n post.source instanceof Source; //=> true\n user.post instanceof Post; //=> true\n // and both models share the same source\n user.source === post.source; //=> true\n ```\n @private\n @method injection\n @param {String} factoryName\n @param {String} property\n @param {String} injectionName\n */\n\n\n injection(fullName, property, injectionName) {\n (true && !(this.isValidFullName(injectionName)) && (0, _debug.assert)(`Invalid injectionName, expected: 'type:name' got: ${injectionName}`, this.isValidFullName(injectionName)));\n var normalizedInjectionName = this.normalize(injectionName);\n\n if (fullName.indexOf(':') === -1) {\n return this.typeInjection(fullName, property, normalizedInjectionName);\n }\n\n (true && !(this.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.isValidFullName(fullName)));\n var normalizedName = this.normalize(fullName);\n var injections = this._injections[normalizedName] || (this._injections[normalizedName] = []);\n injections.push({\n property,\n specifier: normalizedInjectionName\n });\n }\n /**\n @private\n @method knownForType\n @param {String} type the type to iterate over\n */\n\n\n knownForType(type) {\n var localKnown = (0, _utils.dictionary)(null);\n var registeredNames = Object.keys(this.registrations);\n\n for (var index = 0; index < registeredNames.length; index++) {\n var fullName = registeredNames[index];\n var itemType = fullName.split(':')[0];\n\n if (itemType === type) {\n localKnown[fullName] = true;\n }\n }\n\n var fallbackKnown, resolverKnown;\n\n if (this.fallback !== null) {\n fallbackKnown = this.fallback.knownForType(type);\n }\n\n if (this.resolver !== null && this.resolver.knownForType) {\n resolverKnown = this.resolver.knownForType(type);\n }\n\n return (0, _polyfills.assign)({}, fallbackKnown, localKnown, resolverKnown);\n }\n\n isValidFullName(fullName) {\n return VALID_FULL_NAME_REGEXP.test(fullName);\n }\n\n getInjections(fullName) {\n var injections = this._injections[fullName];\n\n if (this.fallback !== null) {\n var fallbackInjections = this.fallback.getInjections(fullName);\n\n if (fallbackInjections !== undefined) {\n injections = injections === undefined ? fallbackInjections : injections.concat(fallbackInjections);\n }\n }\n\n return injections;\n }\n\n getTypeInjections(type) {\n var injections = this._typeInjections[type];\n\n if (this.fallback !== null) {\n var fallbackInjections = this.fallback.getTypeInjections(type);\n\n if (fallbackInjections !== undefined) {\n injections = injections === undefined ? fallbackInjections : injections.concat(fallbackInjections);\n }\n }\n\n return injections;\n }\n /**\n Given a fullName and a source fullName returns the fully resolved\n fullName. Used to allow for local lookup.\n ```javascript\n let registry = new Registry();\n // the twitter factory is added to the module system\n registry.expandLocalLookup('component:post-title', { source: 'template:post' }) // => component:post/post-title\n ```\n @private\n @method expandLocalLookup\n @param {String} fullName\n @param {Object} [options]\n @param {String} [options.source] the fullname of the request source (used for local lookups)\n @return {String} fullName\n */\n\n\n expandLocalLookup(fullName, options) {\n if (this.resolver !== null && this.resolver.expandLocalLookup) {\n (true && !(this.isValidFullName(fullName)) && (0, _debug.assert)('fullName must be a proper full name', this.isValidFullName(fullName)));\n (true && !(!options.source || this.isValidFullName(options.source)) && (0, _debug.assert)('options.source must be a proper full name', !options.source || this.isValidFullName(options.source)));\n var normalizedFullName = this.normalize(fullName);\n var normalizedSource = this.normalize(options.source);\n return expandLocalLookup(this, normalizedFullName, normalizedSource, options.namespace);\n } else if (this.fallback !== null) {\n return this.fallback.expandLocalLookup(fullName, options);\n } else {\n return null;\n }\n }\n\n }\n\n _exports.Registry = Registry;\n\n if (true\n /* DEBUG */\n ) {\n var proto = Registry.prototype;\n\n proto.normalizeInjectionsHash = function (hash) {\n var injections = [];\n\n for (var key in hash) {\n if (hash.hasOwnProperty(key)) {\n var {\n specifier,\n source,\n namespace\n } = hash[key];\n (true && !(this.isValidFullName(specifier)) && (0, _debug.assert)(`Expected a proper full name, given '${specifier}'`, this.isValidFullName(specifier)));\n injections.push({\n property: key,\n specifier,\n source,\n namespace\n });\n }\n }\n\n return injections;\n };\n\n proto.validateInjections = function (injections) {\n if (!injections) {\n return;\n }\n\n for (var i = 0; i < injections.length; i++) {\n var {\n specifier,\n source,\n namespace\n } = injections[i];\n (true && !(this.has(specifier, {\n source,\n namespace\n })) && (0, _debug.assert)(`Attempting to inject an unknown injection: '${specifier}'`, this.has(specifier, {\n source,\n namespace\n })));\n }\n };\n }\n\n function expandLocalLookup(registry, normalizedName, normalizedSource, namespace) {\n var cache = registry._localLookupCache;\n var normalizedNameCache = cache[normalizedName];\n\n if (!normalizedNameCache) {\n normalizedNameCache = cache[normalizedName] = Object.create(null);\n }\n\n var cacheKey = namespace || normalizedSource;\n var cached = normalizedNameCache[cacheKey];\n\n if (cached !== undefined) {\n return cached;\n }\n\n var expanded = registry.resolver.expandLocalLookup(normalizedName, normalizedSource, namespace);\n return normalizedNameCache[cacheKey] = expanded;\n }\n\n function resolve(registry, _normalizedName, options) {\n var normalizedName = _normalizedName; // when `source` is provided expand normalizedName\n // and source into the full normalizedName\n\n if (options !== undefined && (options.source || options.namespace)) {\n normalizedName = registry.expandLocalLookup(_normalizedName, options);\n\n if (!normalizedName) {\n return;\n }\n }\n\n var cached = registry._resolveCache[normalizedName];\n\n if (cached !== undefined) {\n return cached;\n }\n\n if (registry._failSet.has(normalizedName)) {\n return;\n }\n\n var resolved;\n\n if (registry.resolver) {\n resolved = registry.resolver.resolve(normalizedName);\n }\n\n if (resolved === undefined) {\n resolved = registry.registrations[normalizedName];\n }\n\n if (resolved === undefined) {\n registry._failSet.add(normalizedName);\n } else {\n registry._resolveCache[normalizedName] = resolved;\n }\n\n return resolved;\n }\n\n function has(registry, fullName, source, namespace) {\n return registry.resolve(fullName, {\n source,\n namespace\n }) !== undefined;\n }\n\n var privateNames = (0, _utils.dictionary)(null);\n var privateSuffix = `${Math.random()}${Date.now()}`.replace('.', '');\n\n function privatize([fullName]) {\n var name = privateNames[fullName];\n\n if (name) {\n return name;\n }\n\n var [type, rawName] = fullName.split(':');\n return privateNames[fullName] = (0, _utils.intern)(`${type}:${rawName}-${privateSuffix}`);\n }\n /*\n Public API for the container is still in flux.\n The public API, specified on the application namespace should be considered the stable API.\n // @module container\n @private\n */\n\n});","define(\"@ember/-internals/environment/index\", [\"exports\", \"@ember/debug\", \"@ember/deprecated-features\"], function (_exports, _debug, _deprecatedFeatures) {\n \"use strict\";\n\n Object.defineProperty(_exports, \"__esModule\", {\n value: true\n });\n _exports.getLookup = getLookup;\n _exports.setLookup = setLookup;\n _exports.getENV = getENV;\n _exports.ENV = _exports.context = _exports.global = void 0;\n\n // from lodash to catch fake globals\n function checkGlobal(value) {\n return value && value.Object === Object ? value : undefined;\n } // element ids can ruin global miss checks\n\n\n function checkElementIdShadowing(value) {\n return value && value.nodeType === undefined ? value : undefined;\n } // export real global\n\n\n var global$1 = checkGlobal(checkElementIdShadowing(typeof global === 'object' && global)) || checkGlobal(typeof self === 'object' && self) || checkGlobal(typeof window === 'object' && window) || typeof mainContext !== 'undefined' && mainContext || // set before strict mode in Ember loader/wrapper\n new Function('return this')(); // eval outside of strict mode\n\n _exports.global = global$1;\n\n var context = function (global, Ember) {\n return Ember === undefined ? {\n imports: global,\n exports: global,\n lookup: global\n } : {\n // import jQuery\n imports: Ember.imports || global,\n // export Ember\n exports: Ember.exports || global,\n // search for Namespaces\n lookup: Ember.lookup || global\n };\n }(global$1, global$1.Ember);\n\n _exports.context = context;\n\n function getLookup() {\n return context.lookup;\n }\n\n function setLookup(value) {\n context.lookup = value;\n }\n /**\n The hash of environment variables used to control various configuration\n settings. To specify your own or override default settings, add the\n desired properties to a global hash named `EmberENV` (or `ENV` for\n backwards compatibility with earlier versions of Ember). The `EmberENV`\n hash must be created before loading Ember.\n \n @class EmberENV\n @type Object\n @public\n */\n\n\n var ENV = {\n ENABLE_OPTIONAL_FEATURES: false,\n\n /**\n Determines whether Ember should add to `Array`, `Function`, and `String`\n native object prototypes, a few extra methods in order to provide a more\n friendly API.\n We generally recommend leaving this option set to true however, if you need\n to turn it off, you can add the configuration property\n `EXTEND_PROTOTYPES` to `EmberENV` and set it to `false`.\n Note, when disabled (the default configuration for Ember Addons), you will\n instead have to access all methods and functions from the Ember\n namespace.\n @property EXTEND_PROTOTYPES\n @type Boolean\n @default true\n @for EmberENV\n @public\n */\n EXTEND_PROTOTYPES: {\n Array: true,\n Function: true,\n String: true\n },\n\n /**\n The `LOG_STACKTRACE_ON_DEPRECATION` property, when true, tells Ember to log\n a full stack trace during deprecation warnings.\n @property LOG_STACKTRACE_ON_DEPRECATION\n @type Boolean\n @default true\n @for EmberENV\n @public\n */\n LOG_STACKTRACE_ON_DEPRECATION: true,\n\n /**\n The `LOG_VERSION` property, when true, tells Ember to log versions of all\n dependent libraries in use.\n @property LOG_VERSION\n @type Boolean\n @default true\n @for EmberENV\n @public\n */\n LOG_VERSION: true,\n RAISE_ON_DEPRECATION: false,\n STRUCTURED_PROFILE: false,\n\n /**\n Whether to insert a `
` wrapper around the\n application template. See RFC #280.\n This is not intended to be set directly, as the implementation may change in\n the future. Use `@ember/optional-features` instead.\n @property _APPLICATION_TEMPLATE_WRAPPER\n @for EmberENV\n @type Boolean\n @default true\n @private\n */\n _APPLICATION_TEMPLATE_WRAPPER: true,\n\n /**\n Whether to use Glimmer Component semantics (as opposed to the classic \"Curly\"\n components semantics) for template-only components. See RFC #278.\n This is not intended to be set directly, as the implementation may change in\n the future. Use `@ember/optional-features` instead.\n @property _TEMPLATE_ONLY_GLIMMER_COMPONENTS\n @for EmberENV\n @type Boolean\n @default false\n @private\n */\n _TEMPLATE_ONLY_GLIMMER_COMPONENTS: false,\n\n /**\n Whether to perform extra bookkeeping needed to make the `captureRenderTree`\n API work.\n This has to be set before the ember JavaScript code is evaluated. This is\n usually done by setting `window.EmberENV = { _DEBUG_RENDER_TREE: true };`\n or `window.ENV = { _DEBUG_RENDER_TREE: true };` before the \"vendor\"\n `