Skip to content

Instantly share code, notes, and snippets.

@dwickern
Created September 28, 2017 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwickern/1dccff23d1c76eaa84b5fe84431520b3 to your computer and use it in GitHub Desktop.
Save dwickern/1dccff23d1c76eaa84b5fe84431520b3 to your computer and use it in GitHub Desktop.
Typescript typings for ember.js v2.14.1 generated by https://github.com/typed-ember/ember-typings-generator
declare namespace Ember {
/**
* `getEngineParent` retrieves an engine instance's parent instance.
*/
function getEngineParent(engine: EngineInstance): EngineInstance;
/**
* Display a deprecation warning with the provided message and a stack trace
* (Chrome and Firefox only).
*/
function deprecate(message: string, test: boolean, options: {}): any;
/**
* Define an assertion that will throw an exception if the condition is not met.
*/
function assert(desc: string, test: boolean): any;
/**
* Display a debug notice.
*/
function debug(message: string): any;
/**
* Run a function meant for debugging.
*/
function runInDebug(func: Function): any;
/**
* Display a warning with the provided message.
*/
function warn(message: string, test: boolean, options: {}): any;
/**
* Global helper method to create a new binding. Just pass the root object
* along with a `to` and `from` path to create and connect the binding.
*/
function bind(obj: {}, to: string, from: string): Binding;
/**
* Returns the cached value for a property, if one exists.
* This can be useful for peeking at the value of a computed
* property that is generated lazily, without accidentally causing
* it to be created.
*/
function cacheFor(obj: {}, key: string): {};
/**
* Add an event listener
*/
function addListener(obj: any, eventName: string, target: {}|Function, method: Function|string, once: boolean): any;
/**
* Remove an event listener
*/
function removeListener(obj: any, eventName: string, target: {}|Function, method: Function|string): any;
/**
* Send an event. The execution of suspended listeners
* is skipped, and once listeners are removed. A listener without
* a target is executed on the passed object. If an array of actions
* is not passed, the actions stored on the passed object are invoked.
*/
function sendEvent(obj: any, eventName: string, params: any[], actions: any[], meta: Meta): void;
/**
* Define a property as a function that should be executed when
* a specified event or events are triggered.
*/
function on(eventNames: string, func: Function): void;
/**
* To get multiple properties at once, call `Ember.getProperties`
* with an object followed by a list of strings or an array:
*/
function getProperties(obj: {}, ...list: string[]): {};
/**
* A value is blank if it is empty or a whitespace string.
*/
function isBlank(obj: {}): boolean;
/**
* Verifies that a value is `null` or an empty string, empty array,
* or empty function.
*/
function isEmpty(obj: {}): boolean;
/**
* Returns true if the passed value is null or undefined. This avoids errors
* from JSLint complaining about use of ==, which can be technically
* confusing.
*/
function isNone(obj: {}): boolean;
/**
* A value is present if it not `isBlank`.
*/
function isPresent(obj: {}): boolean;
/**
* Merge the contents of two objects together into the first object.
*/
function merge(original: {}, updates: {}): {};
/**
* Makes a method available via an additional name.
*/
function aliasMethod(methodName: string): any;
/**
* Specify a method that observes property changes.
*/
function observer(propertyNames: string, func: Function): void;
function addObserver(obj: any, _path: string, target: {}|Function, method: Function|string): any;
function removeObserver(obj: any, path: string, target: {}|Function, method: Function|string): any;
/**
* Gets the value of a property on an object. If the property is computed,
* the function will be invoked. If the property is not defined but the
* object implements the `unknownProperty` method then that will be invoked.
*/
function get(obj: {}, keyName: string): {};
/**
* Retrieves the value of a property from an Object, or a default value in the
* case that the property returns `undefined`.
*/
function getWithDefault(obj: {}, keyName: string, defaultValue: {}): {};
/**
* Sets the value of a property on an object, respecting computed properties
* and notifying observers and other listeners of the change. If the
* property is not defined but the object implements the `setUnknownProperty`
* method then that will be invoked as well.
*/
function set(obj: {}, keyName: string, value: {}): {};
/**
* Error-tolerant form of `Ember.set`. Will not blow up if any part of the
* chain is `undefined`, `null`, or destroyed.
*/
function trySet(root: {}, path: string, value: {}): any;
/**
* Set a list of properties on an object. These properties are set inside
* a single `beginPropertyChanges` and `endPropertyChanges` batch, so
* observers will be buffered.
*/
function setProperties(obj: any, properties: {}): void;
/**
* Creates an `Ember.NativeArray` from an Array like object.
* Does not modify the original object's contents. Ember.A is not needed if
* `EmberENV.EXTEND_PROTOTYPES` is `true` (the default value). However,
* it is recommended that you use Ember.A when creating addons for
* ember or when you can not guarantee that `EmberENV.EXTEND_PROTOTYPES`
* will be `true`.
*/
function A(): NativeArray;
/**
* Compares two javascript values and returns:
*/
function compare(v: {}, w: {}): number;
/**
* Creates a shallow copy of the passed object. A deep copy of the object is
* returned if the optional `deep` argument is `true`.
*/
function copy(obj: {}, deep: boolean): {};
/**
* Compares two objects, returning true if they are equal.
*/
function isEqual(a: {}, b: {}): boolean;
/**
* Returns true if the passed object is an array or Array-like.
*/
function isArray(obj: {}): boolean;
/**
* Returns a consistent type for the passed object.
*/
function typeOf(item: {}): string;
/**
* Copy properties from a source object to a target object.
*/
function assign(original: {}, args: {}): {};
/**
* Returns a unique id for the object. If the object does not yet have a guid,
* one will be assigned to it. You can call this on any object,
* `Ember.Object`-based or not, but be aware that it will add a `_guid`
* property.
*/
function guidFor(obj: {}): string;
/**
* Checks to see if the `methodName` exists on the `obj`,
* and if it does, invokes it with the arguments passed.
*/
function tryInvoke(obj: {}, methodName: string, args: any[]): any;
/**
* Framework objects in an Ember application (components, services, routes, etc.)
* are created via a factory and dependency injection system. Each of these
* objects is the responsibility of an "owner", which handled its
* instantiation and manages its lifetime.
*/
function getOwner(object: {}): {};
/**
* `setOwner` forces a new owner on a given object instance. This is primarily
* useful in some testing cases.
*/
function setOwner(object: {}, object: {}): any;
/**
* 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.
*/
function onerror(error: Exception): void;
/**
* An empty function useful for some operations. Always returns `this`.
*/
function K(): {};
/**
* The semantic version
*/
const VERSION: string;
/**
* Alias for jQuery
*/
function $(): any;
namespace RSVP {
class EventTarget {
}
/**
* Promise objects represent the eventual result of an asynchronous operation. 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.
*/
class Promise {
/**
* 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.
*/
then(onFulfillment: Function, onRejection: Function, label: string): Ember.RSVP.Promise;
/**
* `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
* as the catch block of a try/catch statement.
*/
catch(onRejection: Function, label: string): Ember.RSVP.Promise;
/**
* `finally` will be invoked regardless of the promise's fate just as native
* try/catch/finally behaves
*/
finally(callback: Function, label: string): Ember.RSVP.Promise;
}
}
namespace ApplicationInstance {
/**
* A list of boot-time configuration options for customizing the behavior of
* an `Ember.ApplicationInstance`.
*/
class BootOptions {
/**
* Run in a full browser environment.
*/
isBrowser: boolean;
/**
* Disable rendering completely.
*/
shouldRender: boolean;
/**
* If present, render into the given `Document` object instead of the
* global `window.document` object.
*/
document: Document;
/**
* If present, overrides the application's `rootElement` property on
* the instance. This is useful for testing environment, where you
* might want to append the root view to a fixture area.
*/
rootElement: string|Element;
/**
* If present, overrides the router's `location` property with this
* value. This is useful for environments where trying to modify the
* URL would be inappropriate.
*/
location: string;
}
}
namespace Test {
/**
* This property contains the testing helpers for the current application. These
* are created once you call `injectTestHelpers` on your `Ember.Application`
* instance. The included helpers are also available on the `window` object by
* default, but can be used from this object on the individual application also.
*/
const testHelpers: {};
/**
* This property indicates whether or not this application is currently in
* testing mode. This is set when `setupForTesting` is called on the current
* application.
*/
const testing: boolean;
/**c
* This injects the test helpers into the `helperContainer` object. If an object is provided
* it will be used as the helperContainer. If `helperContainer` is not set it will default
* to `window`. If a function of the same name has already been defined it will be cached
* (so that it can be reset if the helper is removed with `unregisterHelper` or
* `removeTestHelpers`).
*/
function injectTestHelpers(): any;
/**
* This removes all helpers that have been registered, and resets and functions
* that were overridden by the helpers.
*/
function removeTestHelpers(): any;
/**
* Clicks an element and triggers any actions triggered by the element's `click`
* event.
*/
function click(selector: string, context: {}): RSVP.Promise<undefined>;
/**
* Returns the current path.
*/
function currentPath(): {};
/**
* Returns the currently active route name.
* Example:
* ```javascript
* function validateRouteName() {
* equal(currentRouteName(), 'some.path', "correct route was transitioned into.");
* }
* visit('/some/path').then(validateRouteName)
* ```
*/
function currentRouteName(): {};
/**
* Returns the current URL.
*/
function currentURL(): {};
/**
* Fills in an input element with some text.
*/
function fillIn(selector: string, text: string): RSVP.Promise<undefined>;
/**
* Finds an element in the context of the app's container element. A simple alias
* for `app.$(selector)`.
*/
function find(selector: string, context: string): {};
/**
* Like `find`, but throws an error if the element selector returns no results.
*/
function findWithAssert(selector: string, context: string): {};
/**
* Simulates a key event, e.g. `keypress`, `keydown`, `keyup` with the desired keyCode
* Example:
* ```javascript
* keyEvent('.some-jQuery-selector', 'keypress', 13).then(function() {
* // assert something
* });
* ```
*/
function keyEvent(selector: string, type: string, keyCode: number): RSVP.Promise<undefined>;
/**
* Resumes a test paused by `pauseTest`.
*/
function resumeTest(): void;
/**
* 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):
*/
function pauseTest(): {};
/**
* Triggers the given DOM event on the element identified by the provided selector.
* Example:
* ```javascript
* triggerEvent('#some-elem-id', 'blur');
* ```
* This is actually used internally by the `keyEvent` helper like so:
* ```javascript
* triggerEvent('#some-elem-id', 'keypress', { keyCode: 13 });
* ```
*/
function triggerEvent(selector: string, context: string, type: string, options: {}): RSVP.Promise<undefined>;
/**
* 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.
*/
function visit(url: string): RSVP.Promise<undefined>;
/**
* 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.
*/
function wait(value: {}): RSVP.Promise<any>;
/**
* `registerHelper` is used to register a test helper that will be injected
* when `App.injectTestHelpers` is called.
*/
function registerHelper(name: string, helperMethod: Function, options: {}): any;
/**
* `registerAsyncHelper` is used to register an async test helper that will be injected
* when `App.injectTestHelpers` is called.
*/
function registerAsyncHelper(name: string, helperMethod: Function): any;
/**
* Remove a previously added helper method.
*/
function unregisterHelper(name: string): any;
/**
* Used to register callbacks to be fired whenever `App.injectTestHelpers`
* is called.
*/
function onInjectHelpers(callback: Function): any;
/**
* 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.
*/
function promise(resolver: Function, label: string): any;
/**
* Replacement for `Ember.RSVP.resolve`
* The only difference is this uses
* an instance of `Ember.Test.Promise`
*/
function resolve(The: any): any;
/**
* This allows ember-testing to play nicely with other asynchronous
* events, such as an application that is waiting for a CSS3
* transition or an IndexDB transaction. The waiter runs periodically
* 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.
*/
function registerWaiter(context: {}, callback: Function): any;
/**
* `unregisterWaiter` is used to unregister a callback that was
* registered with `registerWaiter`.
*/
function unregisterWaiter(context: {}, callback: Function): any;
/**
* 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.
*/
function checkWaiters(): any;
/**
* Used to allow ember-testing to communicate with a specific testing
* framework.
*/
const adapter: any;
/**
* The primary purpose of this class is to create hooks that can be implemented
* by an adapter for various test frameworks.
*/
class Adapter {
/**
* This callback will be called whenever an async operation is about to start.
*/
asyncStart(): any;
/**
* This callback will be called whenever an async operation has completed.
*/
asyncEnd(): any;
/**
* Override this method with your testing framework's false assertion.
* This function is called whenever an exception occurs causing the testing
* promise to fail.
*/
exception(error: string): any;
}
/**
* This class implements the methods defined by Ember.Test.Adapter for the
* QUnit testing framework.
*/
class QUnitAdapter extends Adapter {
}
}
/**
* The `ApplicationInstance` encapsulates all of the stateful aspects of a
* running `Application`.
*/
class ApplicationInstance extends EngineInstance {
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): ApplicationInstance;
}
/**
* An instance of `Ember.Application` is the starting point for every Ember
* application. It helps to instantiate, initialize and coordinate the many
* objects that make up your app.
*/
class Application extends Engine implements RegistryProxyMixin {
/**
* The root DOM element of the Application. This can be specified as an
* element or a
* [jQuery-compatible selector string](http://api.jquery.com/category/selectors/).
*/
rootElement: DOMElement;
/**
* The `Ember.EventDispatcher` responsible for delegating events to this
* application's views.
*/
eventDispatcher: EventDispatcher;
/**
* The DOM events for which the event dispatcher should listen.
*/
customEvents: {};
/**
* Use this to defer readiness until some condition is true.
*/
deferReadiness(): any;
/**
* Call `advanceReadiness` after any asynchronous setup logic has completed.
* Each call to `deferReadiness` must be matched by a call to `advanceReadiness`
* or the application will never become ready and routing will not begin.
*/
advanceReadiness(): any;
/**
* Reset the application. This is typically used only in tests. It cleans up
* the application in the following order:
*/
reset(): any;
/**
* Called when the Application has become ready, immediately before routing
* begins. The call will be delayed until the DOM has become ready.
*/
ready(): void;
/**
* Boot a new instance of `Ember.ApplicationInstance` for the current
* application and navigate it to the given `url`. Returns a `Promise` that
* resolves with the instance when the initial routing and rendering is
* complete, or rejects with any error that occurred during the boot process.
*/
visit(url: string, options: ApplicationInstance.BootOptions): Promise<Ember.ApplicationInstance|Error>;
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): Application;
/**
* Given a fullName return the corresponding factory.
*/
resolveRegistration(fullName: string): Function;
/**
* Registers a factory that can be used for dependency injection (with
* `inject`) or for service lookup. Each factory is registered with
* a full name including two parts: `type:name`.
*/
register(fullName: string, factory: Function, options: {}): any;
/**
* Unregister a factory.
*/
unregister(fullName: string): any;
/**
* Check if a factory is registered.
*/
hasRegistration(fullName: string): boolean;
/**
* Register an option for a particular factory.
*/
registerOption(fullName: string, optionName: string, options: {}): any;
/**
* Return a specific registered option for a particular factory.
*/
registeredOption(fullName: string, optionName: string): {};
/**
* Register options for a particular factory.
*/
registerOptions(fullName: string, options: {}): any;
/**
* Return registered options for a particular factory.
*/
registeredOptions(fullName: string): {};
/**
* Allow registering options for all factories of a type.
*/
registerOptionsForType(type: string, options: {}): any;
/**
* Return the registered options for all factories of a type.
*/
registeredOptionsForType(type: string): {};
/**
* Define a dependency injection onto a specific factory or all factories
* of a type.
*/
inject(factoryNameOrType: string, property: string, injectionName: string): any;
}
/**
* The `EngineInstance` encapsulates all of the stateful aspects of a
* running `Engine`.
*/
class EngineInstance extends Ember.Object implements RegistryProxyMixin, ContainerProxyMixin {
/**
* Unregister a factory.
*/
unregister(fullName: string): any;
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): EngineInstance;
/**
* Given a fullName return the corresponding factory.
*/
resolveRegistration(fullName: string): Function;
/**
* Registers a factory that can be used for dependency injection (with
* `inject`) or for service lookup. Each factory is registered with
* a full name including two parts: `type:name`.
*/
register(fullName: string, factory: Function, options: {}): any;
/**
* Check if a factory is registered.
*/
hasRegistration(fullName: string): boolean;
/**
* Register an option for a particular factory.
*/
registerOption(fullName: string, optionName: string, options: {}): any;
/**
* Return a specific registered option for a particular factory.
*/
registeredOption(fullName: string, optionName: string): {};
/**
* Register options for a particular factory.
*/
registerOptions(fullName: string, options: {}): any;
/**
* Return registered options for a particular factory.
*/
registeredOptions(fullName: string): {};
/**
* Allow registering options for all factories of a type.
*/
registerOptionsForType(type: string, options: {}): any;
/**
* Return the registered options for all factories of a type.
*/
registeredOptionsForType(type: string): {};
/**
* Define a dependency injection onto a specific factory or all factories
* of a type.
*/
inject(factoryNameOrType: string, property: string, injectionName: string): any;
/**
* Returns an object that can be used to provide an owner to a
* manually created instance.
*/
ownerInjection(): {};
/**
* Given a fullName return a corresponding instance.
*/
lookup(fullName: string, options: {}): any;
}
/**
* The `Engine` class contains core functionality for both applications and
* engines.
*/
class Engine extends Namespace {
/**
* The goal of initializers should be to register dependencies and injections.
* This phase runs once. Because these initializers may load code, they are
* allowed to defer application readiness and advance it. If you need to access
* the container or store you should use an InstanceInitializer that will be run
* after all initializers and therefore after all code is loaded and the app is
* ready.
*/
initializer(initializer: {}): any;
/**
* Instance initializers run after all initializers have run. Because
* instance initializers run after the app is fully set up. We have access
* to the store, container, and other items. However, these initializers run
* after code has loaded and are not allowed to defer readiness.
*/
instanceInitializer(instanceInitializer: any): any;
/**
* Set this to provide an alternate class to `Ember.DefaultResolver`
*/
resolver: any;
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): Engine;
}
/**
* The DefaultResolver defines the default lookup rules to resolve
* container lookups before consulting the container for registered
* items:
*/
class DefaultResolver extends Ember.Object {
/**
* This will be set to the Application instance when it is
* created.
*/
namespace: any;
/**
* This method is called via the container's resolver method.
* It parses the provided `fullName` and then looks up and
* returns the appropriate template or class.
*/
resolve(fullName: string): {};
/**
* Convert the string name of the form 'type:name' to
* a Javascript object with the parsed aspects of the name
* broken out.
*/
parseName(fullName: string): any;
/**
* Returns a human-readable description for a fullName. Used by the
* Application namespace in assertions to describe the
* precise name of the class that Ember is looking for, rather than
* container keys.
*/
lookupDescription(fullName: string): any;
/**
* Given a parseName object (output from `parseName`), apply
* the conventions expected by `Ember.Router`
*/
useRouterNaming(parsedName: {}): any;
/**
* Look up the template in Ember.TEMPLATES
*/
resolveTemplate(parsedName: {}): any;
/**
* Lookup the view using `resolveOther`
*/
resolveView(parsedName: {}): any;
/**
* Lookup the controller using `resolveOther`
*/
resolveController(parsedName: {}): any;
/**
* Lookup the route using `resolveOther`
*/
resolveRoute(parsedName: {}): any;
/**
* Lookup the model on the Application namespace
*/
resolveModel(parsedName: {}): any;
/**
* Look up the specified object (from parsedName) on the appropriate
* namespace (usually on the Application)
*/
resolveHelper(parsedName: {}): any;
/**
* Look up the specified object (from parsedName) on the appropriate
* namespace (usually on the Application)
*/
resolveOther(parsedName: {}): any;
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): DefaultResolver;
}
class Debug {
/**
* Allows for runtime registration of handler functions that override the default deprecation behavior.
* Deprecations are invoked by calls to [Ember.deprecate](http://emberjs.com/api/classes/Ember.html#method_deprecate).
* The following example demonstrates its usage by registering a handler that throws an error if the
* message contains the word "should", otherwise defers to the default handler.
*/
static registerDeprecationHandler(handler: Function): any;
/**
* Allows for runtime registration of handler functions that override the default warning behavior.
* Warnings are invoked by calls made to [Ember.warn](http://emberjs.com/api/classes/Ember.html#method_warn).
* The following example demonstrates its usage by registering a handler that does nothing overriding Ember's
* default warning behavior.
*/
static registerWarnHandler(handler: Function): any;
}
/**
* A subclass of the JavaScript Error object for use in Ember.
*/
class Error {
}
/**
* The hash of enabled Canary features. Add to this, any canary features
* before creating your application.
*/
class FEATURES {
/**
* Determine whether the specified `feature` is enabled. Used by Ember's
* build tools to exclude experimental features from beta/stable builds.
*/
isEnabled(feature: string): boolean;
}
/**
* The `ContainerDebugAdapter` helps the container and resolver interface
* with tools that debug Ember such as the
* [Ember Inspector](https://github.com/emberjs/ember-inspector)
* for Chrome and Firefox.
*/
class ContainerDebugAdapter extends Ember.Object {
/**
* The resolver instance of the application
* being debugged. This property will be injected
* on creation.
*/
resolver: any;
/**
* Returns true if it is possible to catalog a list of available
* classes in the resolver for a given type.
*/
canCatalogEntriesByType(type: string): boolean;
/**
* Returns the available classes a given type.
*/
catalogEntriesByType(type: string): any[];
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): ContainerDebugAdapter;
}
/**
* The `DataAdapter` helps a data persistence library
* interface with tools that debug Ember such
* as the [Ember Extension](https://github.com/tildeio/ember-extension)
* for Chrome and Firefox.
*/
class DataAdapter {
/**
* The container-debug-adapter which is used
* to list all models.
*/
containerDebugAdapter: any;
/**
* Ember Data > v1.0.0-beta.18
* requires string model names to be passed
* around instead of the actual factories.
*/
acceptsModelName: any;
/**
* Specifies how records can be filtered.
* Records returned will need to have a `filterValues`
* property with a key for every name in the returned array.
*/
getFilters(): any[];
/**
* Fetch the model types and observe them for changes.
*/
watchModelTypes(typesAdded: Function, typesUpdated: Function): Function;
/**
* Fetch the records of a given type and observe them for changes.
*/
watchRecords(modelName: string, recordsAdded: Function, recordsUpdated: Function, recordsRemoved: Function): Function;
}
/**
* The internal class used to create text inputs when the `{{input}}`
* helper is used with `type` of `checkbox`.
*/
class Checkbox extends Component {
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): Checkbox;
}
/**
* `Ember.LinkComponent` renders an element whose `click` event triggers a
* transition of the application's instance of `Ember.Router` to
* a supplied route by name.
*/
class LinkComponent extends Component {
/**
* Used to determine when this `LinkComponent` is active.
*/
currentWhen: any;
/**
* Sets the `title` attribute of the `LinkComponent`'s HTML element.
*/
title: any;
/**
* Sets the `rel` attribute of the `LinkComponent`'s HTML element.
*/
rel: any;
/**
* Sets the `tabindex` attribute of the `LinkComponent`'s HTML element.
*/
tabindex: any;
/**
* Sets the `target` attribute of the `LinkComponent`'s HTML element.
*/
target: any;
/**
* The CSS class to apply to `LinkComponent`'s element when its `active`
* property is `true`.
*/
activeClass: string;
/**
* Determines whether the `LinkComponent` will trigger routing via
* the `replaceWith` routing strategy.
*/
replace: boolean;
/**
* By default the `{{link-to}}` component will bind to the `href` and
* `title` attributes. It's discouraged that you override these defaults,
* however you can push onto the array if needed.
*/
attributeBindings: any[];
/**
* By default the `{{link-to}}` component will bind to the `active`, `loading`,
* and `disabled` classes. It is discouraged to override these directly.
*/
classNameBindings: any[];
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): LinkComponent;
}
/**
* The internal class used to create textarea element when the `{{textarea}}`
* helper is used.
*/
class TextArea extends Component implements TextSupport {
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): TextArea;
}
/**
* The internal class used to create text inputs when the `{{input}}`
* helper is used with `type` of `text`.
* See [Ember.Templates.helpers.input](/api/classes/Ember.Templates.helpers.html#method_input) for usage details.
* ## Layout and LayoutName properties
* Because HTML `input` elements are self closing `layout` and `layoutName`
* properties will not be applied. See [Ember.View](/api/classes/Ember.View.html)'s
* layout section for more information.
*/
class TextField extends Component implements TextSupport {
/**
* The `value` attribute of the input element. As the user inputs text, this
* property is updated live.
*/
value: string;
/**
* The `type` attribute of the input element.
*/
type: string;
/**
* The `size` of the text field in characters.
*/
size: string;
/**
* The `pattern` attribute of input element.
*/
pattern: string;
/**
* The `min` attribute of input element used with `type="number"` or `type="range"`.
*/
min: string;
/**
* The `max` attribute of input element used with `type="number"` or `type="range"`.
*/
max: string;
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): TextField;
}
/**
* 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 {
/**
* Mark a string as safe for unescaped output with Ember templates. If you
* return HTML from a helper, use this function to
* ensure Ember's rendering layer does not escape the HTML.
*/
static htmlSafe(): Handlebars.SafeString;
/**
* Detects if a string was decorated using `Ember.String.htmlSafe`.
*/
static isHTMLSafe(): boolean;
/**
* DEPRECATED: Use ES6 template strings instead: http://babeljs.io/docs/learn-es2015/#template-strings
* Apply formatting options to the string. This will look for occurrences
* of "%@" in your string and substitute them with the arguments you pass into
* this method. If you want to control the specific order of replacement,
* you can add a number after the key as well to indicate which argument
* you want to insert.
*/
fmt(str: string, formats: any[]): string;
/**
* Formats the passed string, but first looks up the string in the localized
* strings hash. This is a convenient way to localize text. See
* `Ember.String.fmt()` for more information on formatting.
*/
loc(str: string, formats: any[]): string;
/**
* 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`.
*/
w(str: string): any[];
/**
* Converts a camelized string into all lower case separated by underscores.
*/
decamelize(str: string): string;
/**
* Replaces underscores, spaces, or camelCase with dashes.
*/
dasherize(str: string): string;
/**
* Returns the lowerCamelCase form of a string.
*/
camelize(str: string): string;
/**
* Returns the UpperCamelCase form of a string.
*/
classify(str: string): string;
/**
* More general than decamelize. Returns the lower\_case\_and\_underscored
* form of a string.
*/
underscore(str: string): string;
/**
* Returns the Capitalized form of a string
*/
capitalize(str: string): string;
}
/**
* An `Ember.Component` is a view that is completely
* isolated. Properties accessed in its templates go
* to the view object and actions are targeted at
* the view object. There is no access to the
* surrounding context or outer controller; all
* contextual information must be passed in.
*/
class Component extends CoreView implements TargetActionSupport, ClassNamesSupport, ActionSupport, ViewMixin {
/**
* Normally, Ember's component model is "write-only". The component takes a
* bunch of attributes that it got passed in, and uses them to render its
* template.
*/
readDOMAttr(name: string): void;
/**
* The WAI-ARIA role of the control represented by this view. For example, a
* button may have a role of type 'button', or a pane may have a role of
* type 'alertdialog'. This property is used by assistive software to help
* visually challenged users navigate rich web applications.
*/
ariaRole: string;
/**
* Enables components to take a list of parameters as arguments.
* For example, a component that takes two parameters with the names
* `name` and `age`:
*/
static positionalParams: any;
/**
* Called when the attributes passed into the component have been updated.
* Called both during the initial render of a container and during a rerender.
* Can be used in place of an observer; code placed here will be executed
* every time any attribute updates.
*/
didReceiveAttrs(): void;
/**
* Called after a component has been rendered, both on initial render and
* in subsequent rerenders.
*/
didRender(): void;
/**
* Called before a component has been rendered, both on initial render and
* in subsequent rerenders.
*/
willRender(): void;
/**
* Called when the attributes passed into the component have been changed.
* Called only during a rerender, not during an initial render.
*/
didUpdateAttrs(): void;
/**
* Called when the component is about to update and rerender itself.
* Called only during a rerender, not during an initial render.
*/
willUpdate(): void;
/**
* Called when the component has updated and rerendered itself.
* Called only during a rerender, not during an initial render.
*/
didUpdate(): void;
/**
* A component may contain a layout. A layout is a regular template but
* supersedes the `template` property during rendering. It is the
* responsibility of the layout template to retrieve the `template`
* property from the component (or alternatively, call `Handlebars.helpers.yield`,
* `{{yield}}`) to render it in the correct location.
* This is useful for a component that has a shared wrapper, but which delegates
* the rendering of the contents of the wrapper to the `template` property
* on a subclass.
*/
layout: Function;
/**
* Returns a jQuery object for this component's element. If you pass in a selector
* string, this method will return a jQuery object, using the current element
* as its buffer.
* For example, calling `component.$('li')` will return a jQuery object containing
* all of the `li` elements inside the DOM element of this component.
*/
$(selector: string): JQuery;
/**
* The HTML `id` of the component's element in the DOM. You can provide this
* value yourself but it must be unique (just as in HTML):
*/
elementId: string;
/**
* If `false`, the view will appear hidden in DOM.
*/
isVisible: boolean;
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): Component;
/**
* Standard CSS class names to apply to the view's outer element. This
* property automatically inherits any class names defined by the view's
* superclasses as well.
*/
classNames: any[];
/**
* A list of properties of the view to apply as class names. If the property
* is a string value, the value of that string will be applied as a class
* name.
*/
classNameBindings: any[];
/**
* Calls an action passed to a component.
*/
sendAction(action: string, params: any): any;
/**
* A list of properties of the view to apply as attributes. If the property
* is a string value, the value of that string will be applied as the value
* for an attribute of the property's name.
*/
attributeBindings: any[];
/**
* Renders the view again. This will work regardless of whether the
* view is already in the DOM or not. If the view is in the DOM, the
* rendering process will be deferred to give bindings a chance
* to synchronize.
*/
rerender(): any;
/**
* Returns the current DOM element for the view.
*/
element: DOMElement;
/**
* Called when a view is going to insert an element into the DOM.
*/
willInsertElement(): void;
/**
* Called when the element of the view has been inserted into the DOM.
* Override this function to do any set up that requires an element
* in the document body.
*/
didInsertElement(): void;
/**
* Called when the view is about to rerender, but before anything has
* been torn down. This is a good opportunity to tear down any manual
* observers you have installed based on the DOM state
*/
willClearRender(): void;
/**
* Called when the element of the view is going to be destroyed. Override
* this function to do any teardown that requires an element, like removing
* event listeners.
*/
willDestroyElement(): void;
/**
* Tag name for the view's outer element. The tag name is only used when an
* element is first created. If you change the `tagName` for an element, you
* must destroy and recreate the view element.
*/
tagName: string;
}
/**
* Ember Helpers are functions that can compute values, and are used in templates.
* For example, this code calls a helper named `format-currency`:
*/
class Helper {
/**
* On a class-based helper, it may be useful to force a recomputation of that
* helpers value. This is akin to `rerender` on a component.
*/
recompute(): any;
/**
* Override this function when writing a class-based helper.
*/
compute(params: any[], hash: {}): any;
/**
* In many cases, the ceremony of a full `Ember.Helper` class is not required.
* The `helper` method create pure-function helpers without instances. For
* example:
*/
static helper(helper: Function): any;
}
/**
* DEPRECATED: See http://emberjs.com/deprecations/v2.x#toc_ember-binding
* An `Ember.Binding` connects the properties of two objects so that whenever
* the value of one property changes, the other property will be changed also.
*/
class Binding {
/**
* DEPRECATED: See http://emberjs.com/deprecations/v2.x#toc_ember-binding
* This copies the Binding so it can be connected to another object.
*/
copy(): Binding;
/**
* DEPRECATED: See http://emberjs.com/deprecations/v2.x#toc_ember-binding
* This will set `from` property path to the specified value. It will not
* attempt to resolve this property path to an actual object until you
* connect the binding.
*/
from(path: string): Binding;
/**
* DEPRECATED: See http://emberjs.com/deprecations/v2.x#toc_ember-binding
* This will set the `to` property path to the specified value. It will not
* attempt to resolve this property path to an actual object until you
* connect the binding.
*/
to(path: string|any[]): Binding;
/**
* DEPRECATED: See http://emberjs.com/deprecations/v2.x#toc_ember-binding
* Configures the binding as one way. A one-way binding will relay changes
* on the `from` side to the `to` side, but not the other way around. This
* means that if you change the `to` side directly, the `from` side may have
* a different value.
*/
oneWay(): Binding;
/**
* DEPRECATED: See http://emberjs.com/deprecations/v2.x#toc_ember-binding
*/
toString(): string;
/**
* DEPRECATED: See http://emberjs.com/deprecations/v2.x#toc_ember-binding
* Attempts to connect this binding instance so that it can receive and relay
* changes. This method will raise an exception if you have not set the
* from/to properties yet.
*/
connect(obj: {}): Binding;
/**
* DEPRECATED: See http://emberjs.com/deprecations/v2.x#toc_ember-binding
* Disconnects the binding instance. Changes will no longer be relayed. You
* will not usually need to call this method.
*/
disconnect(): Binding;
}
/**
* A computed property transforms an object literal with object's accessor function(s) into a property.
*/
class ComputedProperty {
/**
* Call on a computed property to set it into non-cached mode. When in this
* mode the computed property will not automatically cache the return value.
*/
volatile(): ComputedProperty;
/**
* Call on a computed property to set it into read-only mode. When in this
* mode the computed property will throw an error when set.
*/
readOnly(): ComputedProperty;
/**
* Sets the dependent keys on this computed property. Pass any number of
* arguments containing key paths that this computed property depends on.
*/
property(path: string): ComputedProperty;
/**
* In some cases, you may want to annotate computed properties with additional
* metadata about how they function or what values they operate on. For example,
* computed property functions may close over variables that are then no longer
* available for introspection.
*/
meta(meta: {}): any;
}
/**
* This helper returns a new property descriptor that wraps the passed
* computed property function. You can use this helper to define properties
* with mixins or via `Ember.defineProperty()`.
*/
class computed {
/**
* A computed property that returns true if the value of the dependent
* property is null, an empty string, empty array, or empty function.
*/
empty(dependentKey: string): ComputedProperty;
/**
* A computed property that returns true if the value of the dependent
* property is NOT null, an empty string, empty array, or empty function.
*/
notEmpty(dependentKey: string): ComputedProperty;
/**
* 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.
*/
none(dependentKey: string): ComputedProperty;
/**
* A computed property that returns the inverse boolean value
* of the original value for the dependent property.
*/
not(dependentKey: string): ComputedProperty;
/**
* A computed property that converts the provided dependent property
* into a boolean value.
*/
bool(dependentKey: string): ComputedProperty;
/**
* 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.
*/
match(dependentKey: string, regexp: RegExp): ComputedProperty;
/**
* A computed property that returns true if the provided dependent property
* is equal to the given value.
*/
equal(dependentKey: string, value: string|number|{}): ComputedProperty;
/**
* A computed property that returns true if the provided dependent property
* is greater than the provided value.
*/
gt(dependentKey: string, value: number): ComputedProperty;
/**
* A computed property that returns true if the provided dependent property
* is greater than or equal to the provided value.
*/
gte(dependentKey: string, value: number): ComputedProperty;
/**
* A computed property that returns true if the provided dependent property
* is less than the provided value.
*/
lt(dependentKey: string, value: number): ComputedProperty;
/**
* A computed property that returns true if the provided dependent property
* is less than or equal to the provided value.
*/
lte(dependentKey: string, value: number): ComputedProperty;
/**
* A computed property that performs a logical `and` on the
* original values for the provided dependent properties.
*/
and(dependentKey: string): ComputedProperty;
/**
* A computed property which performs a logical `or` on the
* original values for the provided dependent properties.
*/
or(dependentKey: string): ComputedProperty;
/**
* 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.
*/
alias(dependentKey: string): ComputedProperty;
/**
* Where `computed.alias` aliases `get` and `set`, and allows for bidirectional
* data flow, `computed.oneWay` only provides an aliased `get`. The `set` will
* 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.
*/
oneWay(dependentKey: string): ComputedProperty;
/**
* This is a more semantically meaningful alias of `computed.oneWay`,
* whose name is somewhat ambiguous as to which direction the data flows.
*/
reads(dependentKey: string): ComputedProperty;
/**
* 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.
*/
readOnly(dependentKey: string): ComputedProperty;
/**
* 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.
*/
deprecatingAlias(dependentKey: string, options: {}): ComputedProperty;
/**
* A computed property that returns the sum of the values
* in the dependent array.
*/
sum(dependentKey: string): ComputedProperty;
/**
* A computed property that calculates the maximum value in the
* dependent array. This will return `-Infinity` when the dependent
* array is empty.
*/
max(dependentKey: string): ComputedProperty;
/**
* A computed property that calculates the minimum value in the
* dependent array. This will return `Infinity` when the dependent
* array is empty.
*/
min(dependentKey: string): ComputedProperty;
/**
* Returns an array mapped via the callback
*/
map(dependentKey: string, callback: Function): ComputedProperty;
/**
* Returns an array mapped to the specified key.
*/
mapBy(dependentKey: string, propertyKey: string): ComputedProperty;
/**
* Filters the array by the callback.
*/
filter(dependentKey: string, callback: Function): ComputedProperty;
/**
* Filters the array by the property and value
*/
filterBy(dependentKey: string, propertyKey: string, value: any): ComputedProperty;
/**
* A computed property which returns a new array with all the unique
* elements from one or more dependent arrays.
*/
uniq(propertyKey: string): ComputedProperty;
/**
* A computed property which returns a new array with all the unique
* elements from an array, with uniqueness determined by specific key.
*/
uniqBy(dependentKey: string, propertyKey: string): ComputedProperty;
/**
* A computed property which returns a new array with all the unique
* elements from one or more dependent arrays.
*/
union(propertyKey: string): ComputedProperty;
/**
* A computed property which returns a new array with all the elements
* two or more dependent arrays have in common.
*/
intersect(propertyKey: string): ComputedProperty;
/**
* 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.
*/
setDiff(setAProperty: string, setBProperty: string): ComputedProperty;
/**
* A computed property that returns the array of values
* for the provided dependent properties.
*/
collect(dependentKey: string): ComputedProperty;
/**
* 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.
*/
sort(itemsKey: string, sortDefinition: string): ComputedProperty;
}
/**
* Read-only property that returns the result of a container lookup.
*/
class InjectedProperty {
}
/**
* The purpose of the Ember Instrumentation module is
* to provide efficient, general-purpose instrumentation
* for Ember.
*/
class Instrumentation {
}
/**
* This class is used internally by Ember and Ember Data.
* Please do not use it at this time. We plan to clean it up
* and add many tests soon.
*/
class OrderedSet {
}
/**
* A Map stores values indexed by keys. Unlike JavaScript's
* default Objects, the keys of a Map can be any JavaScript
* object.
*/
class Map {
}
class MapWithDefault extends Map {
}
/**
* The `Ember.Mixin` class allows you to create mixins, whose properties can be
* added to other classes. For instance,
*/
class Mixin {
static create(args: any): Mixin;
}
/**
* Runs the passed target and method inside of a RunLoop, ensuring any
* deferred actions including bindings and views updates are flushed at the
* end.
*/
class run {
/**
* 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.
*/
join(target: {}, method: Function|string, ...args: any[]): {};
/**
* Allows you to specify which context to call the specified function in while
* adding the execution of that function to the Ember run loop. This ability
* makes this method a great way to asynchronously integrate third-party libraries
* into your Ember application.
*/
bind(target: {}, method: Function|string, ...args: any[]): Function;
/**
* Begins a new RunLoop. Any deferred actions invoked after the begin will
* be buffered until you invoke a matching call to `run.end()`. This is
* a lower-level way to use a RunLoop instead of using `run()`.
*/
begin(): void;
/**
* Ends a RunLoop. This must be called sometime after you call
* `run.begin()` to flush any deferred actions. This is a lower-level way
* to use a RunLoop instead of using `run()`.
*/
end(): void;
/**
* Adds the passed target/method and any optional arguments to the named
* 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.
*/
schedule(queue: string, target: {}, method: string|Function, ...args: any[]): any;
/**
* 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.
*/
later(target: {}, method: Function|string, ...args: any[]): any;
later(target: {}, method: Function|string, wait: number): any;
/**
* Schedule a function to run one time during the current RunLoop. This is equivalent
* to calling `scheduleOnce` with the "actions" queue.
*/
once(target: {}, method: Function|string, ...args: any[]): {};
/**
* 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).
*/
scheduleOnce(queue: string, target: {}, method: Function|string, ...args: any[]): {};
/**
* Schedules an item to run from within a separate run loop, after
* control has been returned to the system. This is equivalent to calling
* `run.later` with a wait time of 1ms.
*/
next(target: {}, method: Function|string, ...args: any[]): {};
/**
* Cancels a scheduled item. Must be a value returned by `run.later()`,
* `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or
* `run.throttle()`.
*/
cancel(timer: {}): boolean;
/**
* Delay calling the target method until the debounce period has elapsed
* 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.
*/
debounce(target: {}, method: Function|string, ...args: any[]): any[];
debounce(target: {}, method: Function|string, wait: number, immediate: boolean): any[];
/**
* Ensure that the target method is never called more frequently than
* the specified spacing period. The target method is called immediately.
*/
throttle(target: {}, method: Function|string, ...args: any[]): any[];
throttle(target: {}, method: Function|string, spacing: number, immediate: boolean): any[];
}
class ControllerMixin implements ActionHandler {
/**
* Defines which query parameters the controller accepts.
* If you give the names `['category','page']` it will bind
* the values of these query parameters to the variables
* `this.category` and `this.page`.
* By default, Ember coerces query parameter values using `toggleProperty`.
* This behavior may lead to unexpected results.
* To explicity configure a query parameter property so it coerces as expected, you must define a type property:
* ```javascript
* queryParams: [{
* category: {
* type: 'boolean'
* }
* }]
* ```
*/
queryParams: any;
/**
* Transition the application into another route. The route may
* be either a single route or route path:
*/
transitionToRoute(name: string, ...models: any[]): any;
transitionToRoute(name: string, options: {}): any;
/**
* Transition into another route while replacing the current URL, if possible.
* This will replace the current history entry instead of adding a new one.
* Beside that, it is identical to `transitionToRoute` in all other respects.
*/
replaceRoute(name: string, ...models: any[]): any;
/**
* The object to which actions from the view should be sent.
*/
target: any;
/**
* The controller's current model. When retrieving or modifying a controller's
* model, this property should be used instead of the `content` property.
*/
model: any;
/**
* The collection of functions, keyed by name, available on this
* `ActionHandler` as action targets.
*/
actions: {};
/**
* Triggers a named action on the `ActionHandler`. Any parameters
* supplied after the `actionName` string will be passed as arguments
* to the action target function.
*/
send(actionName: string, context: any): any;
}
/**
* Ember.Location returns an instance of the correct implementation of
* the `location` API.
*/
class Location {
}
/**
* Ember.AutoLocation will select the best location option based off browser
* support with the priority order: history, hash, none.
*/
class AutoLocation {
}
/**
* `Ember.HashLocation` implements the location API using the browser's
* hash. At present, it relies on a `hashchange` event existing in the
* browser.
*/
class HashLocation extends Ember.Object {
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): HashLocation;
}
/**
* Ember.HistoryLocation implements the location API using the browser's
* history.pushState API.
*/
class HistoryLocation extends Ember.Object {
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): HistoryLocation;
}
/**
* Ember.NoneLocation does not interact with the browser. It is useful for
* testing, or when you need to manage state with your Router, but temporarily
* don't want it to muck with the URL (for example when you embed your
* application in a larger page).
*/
class NoneLocation extends Ember.Object {
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): NoneLocation;
}
/**
* The `Ember.Route` class is used to define individual routes. Refer to
* the [routing guide](http://emberjs.com/guides/routing/) for documentation.
*/
class Route extends Ember.Object implements ActionHandler, Evented {
/**
* Configuration hash for this route's queryParams. The possible
* configuration options and their defaults are as follows
* (assuming a query param whose controller property is `page`):
*/
queryParams: {};
/**
* The name of the route, dot-delimited.
*/
routeName: string;
/**
* Returns a hash containing the parameters of an ancestor route.
*/
paramsFor(name: string): {};
/**
* A hook you can use to reset controller values either when the model
* changes or the route is exiting.
*/
resetController(controller: Controller, isExiting: boolean, transition: {}): any;
/**
* The name of the template to use by default when rendering this routes
* template.
*/
templateName: string;
/**
* The name of the controller to associate with this route.
*/
controllerName: string;
/**
* The `willTransition` action is fired at the beginning of any
* attempted transition with a `Transition` object as the sole
* argument. This action can be used for aborting, redirecting,
* or decorating the transition from the currently active routes.
*/
willTransition(transition: Transition): void;
/**
* The `didTransition` action is fired after a transition has
* successfully been completed. This occurs after the normal model
* hooks (`beforeModel`, `model`, `afterModel`, `setupController`)
* have resolved. The `didTransition` action has no arguments,
* however, it can be useful for tracking page views or resetting
* state on the controller.
*/
didTransition(): void;
/**
* The `loading` action is fired on the route when a route's `model`
* hook returns a promise that is not already resolved. The current
* `Transition` object is the first parameter and the route that
* triggered the loading event is the second parameter.
*/
loading(transition: Transition, route: Route): void;
/**
* When attempting to transition into a route, any of the hooks
* may return a promise that rejects, at which point an `error`
* action will be fired on the partially-entered routes, allowing
* for per-route error handling logic, or shared error handling
* logic defined on a parent route.
*/
error(error: Error, transition: Transition): void;
/**
* This hook is executed when the router enters the route. It is not executed
* when the model for the route changes.
*/
activate(): any;
/**
* This hook is executed when the router completely exits this route. It is
* not executed when the model for the route changes.
*/
deactivate(): any;
/**
* The controller associated with this route.
*/
controller: Controller;
/**
* Transition the application into another route. The route may
* be either a single route or route path:
*/
transitionTo(name: string, ...models: any[]): Transition;
transitionTo(name: string, options: {}): Transition;
/**
* Perform a synchronous transition into another route without attempting
* to resolve promises, update the URL, or abort any currently active
* asynchronous transitions (i.e. regular transitions caused by
* `transitionTo` or URL changes).
*/
intermediateTransitionTo(name: string, ...models: any[]): any;
/**
* Refresh the model on this route and any child routes, firing the
* `beforeModel`, `model`, and `afterModel` hooks in a similar fashion
* to how routes are entered when transitioning in from other route.
* The current route params (e.g. `article_id`) will be passed in
* to the respective model hooks, and if a different model is returned,
* `setupController` and associated route hooks will re-fire as well.
*/
refresh(): Transition;
/**
* Transition into another route while replacing the current URL, if possible.
* This will replace the current history entry instead of adding a new one.
* Beside that, it is identical to `transitionTo` in all other respects. See
* 'transitionTo' for additional information regarding multiple models.
*/
replaceWith(name: string, ...models: any[]): Transition;
replaceWith(name: string, options: {}): Transition;
/**
* Sends an action to the router, which will delegate it to the currently
* active route hierarchy per the bubbling rules explained under `actions`.
*/
send(name: string, ...args: any[]): any;
/**
* This hook is the first of the route entry validation hooks
* called when an attempt is made to transition into a route
* or one of its children. It is called before `model` and
* `afterModel`, and is appropriate for cases when:
*/
beforeModel(transition: Transition): any;
/**
* This hook is called after this route's model has resolved.
* It follows identical async/promise semantics to `beforeModel`
* but is provided the route's resolved model in addition to
* the `transition`, and is therefore suited to performing
* logic that can only take place after the model has already
* resolved.
*/
afterModel(resolvedModel: {}, transition: Transition): any;
/**
* A hook you can implement to optionally redirect to another route.
*/
redirect(model: {}, transition: Transition): any;
/**
* A hook you can implement to convert the URL into the model for
* this route.
*/
model(params: {}, transition: Transition): any;
/**
* A hook you can implement to convert the route's model into parameters
* for the URL.
*/
serialize(model: {}, params: any[]): {};
/**
* A hook you can use to setup the controller for the current route.
*/
setupController(controller: Controller, model: {}): any;
/**
* Returns the controller of the current route, or a parent (or any ancestor)
* route in a route hierarchy.
*/
controllerFor(name: string): Controller;
/**
* Returns the resolved model of a parent (or any ancestor) route
* in a route hierarchy. During a transition, all routes
* must resolve a model object, and if a route
* needs access to a parent route's model in order to
* resolve a model (or just reuse the model from a parent),
* it can call `this.modelFor(theNameOfParentRoute)` to
* retrieve it. If the ancestor route's model was a promise,
* its resolved result is returned.
*/
modelFor(name: string): {};
/**
* A hook you can use to render the template for the current route.
*/
renderTemplate(controller: {}, model: {}): any;
/**
* `render` is used to render a template into a region of another template
* (indicated by an `{{outlet}}`). `render` is used both during the entry
* phase of routing (via the `renderTemplate` hook) and later in response to
* user interaction.
*/
render(name: string, options: {}): any;
/**
* Disconnects a view that has been rendered into an outlet.
*/
disconnectOutlet(options: {}|string): any;
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): Route;
/**
* The collection of functions, keyed by name, available on this
* `ActionHandler` as action targets.
*/
actions: {};
/**
* Subscribes to a named event with given function.
*/
on(name: string, target: {}, method: Function): void;
/**
* Subscribes a function to a named event and then cancels the subscription
* after the first time the event is triggered. It is good to use ``one`` when
* you only care about the first time an event has taken place.
*/
one(name: string, target: {}, method: Function): void;
/**
* Triggers a named event for the object. Any additional arguments
* will be passed as parameters to the functions that are subscribed to the
* event.
*/
trigger(name: string, ...args: any[]): any;
/**
* Cancels subscription for given name, target, and method.
*/
off(name: string, target: {}, method: Function): void;
/**
* Checks to see if object has any subscriptions for named event.
*/
has(name: string): boolean;
}
/**
* The `Ember.Router` class manages the application state and URLs. Refer to
* the [routing guide](http://emberjs.com/guides/routing/) for documentation.
*/
class Router extends Ember.Object implements Evented {
/**
* The `location` property determines the type of URL's that your
* application will use.
*/
location: any;
/**
* Represents the URL of the root of the application, often '/'. This prefix is
* assumed on all routes defined on this router.
*/
rootURL: any;
/**
* Handles updating the paths and notifying any listeners of the URL
* change.
*/
didTransition(): any;
/**
* Handles notifying any listeners of an impending URL
* change.
*/
willTransition(): any;
/**
* Transition the application into another route. The route may
* be either a single route or route path:
*/
transitionTo(name: string, ...models: any[]): Transition;
transitionTo(name: string, options: {}): Transition;
/**
* The `Router.map` function allows you to define mappings from URLs to routes
* in your application. These mappings are defined within the
* supplied callback function using `this.route`.
*/
map(callback: any): any;
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): Router;
/**
* Subscribes to a named event with given function.
*/
on(name: string, target: {}, method: Function): void;
/**
* Subscribes a function to a named event and then cancels the subscription
* after the first time the event is triggered. It is good to use ``one`` when
* you only care about the first time an event has taken place.
*/
one(name: string, target: {}, method: Function): void;
/**
* Triggers a named event for the object. Any additional arguments
* will be passed as parameters to the functions that are subscribed to the
* event.
*/
trigger(name: string, ...args: any[]): any;
/**
* Cancels subscription for given name, target, and method.
*/
off(name: string, target: {}, method: Function): void;
/**
* Checks to see if object has any subscriptions for named event.
*/
has(name: string): boolean;
}
class Controller extends Ember.Object implements ControllerMixin {
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): Controller;
/**
* Defines which query parameters the controller accepts.
* If you give the names `['category','page']` it will bind
* the values of these query parameters to the variables
* `this.category` and `this.page`.
* By default, Ember coerces query parameter values using `toggleProperty`.
* This behavior may lead to unexpected results.
* To explicity configure a query parameter property so it coerces as expected, you must define a type property:
* ```javascript
* queryParams: [{
* category: {
* type: 'boolean'
* }
* }]
* ```
*/
queryParams: any;
/**
* Transition the application into another route. The route may
* be either a single route or route path:
*/
transitionToRoute(name: string, ...models: any[]): any;
transitionToRoute(name: string, options: {}): any;
/**
* Transition into another route while replacing the current URL, if possible.
* This will replace the current history entry instead of adding a new one.
* Beside that, it is identical to `transitionToRoute` in all other respects.
*/
replaceRoute(name: string, ...models: any[]): any;
/**
* The object to which actions from the view should be sent.
*/
target: any;
/**
* The controller's current model. When retrieving or modifying a controller's
* model, this property should be used instead of the `content` property.
*/
model: any;
/**
* The collection of functions, keyed by name, available on this
* `ActionHandler` as action targets.
*/
actions: {};
/**
* Triggers a named action on the `ActionHandler`. Any parameters
* supplied after the `actionName` string will be passed as arguments
* to the action target function.
*/
send(actionName: string, context: any): any;
}
/**
* Namespace for injection helper methods.
*/
class inject {
/**
* Creates a property that lazily looks up another controller in the container.
* Can only be used when defining another controller.
*/
controller(name: string): InjectedProperty;
/**
* 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.
*/
service(name: string): InjectedProperty;
}
/**
* `Ember.ProxyMixin` forwards all properties not defined by the proxy itself
* to a proxied `content` object. See Ember.ObjectProxy for more details.
*/
class ProxyMixin {
}
/**
* `Ember.ActionHandler` is available on some familiar classes including
* `Ember.Route`, `Ember.Component`, and `Ember.Controller`.
* (Internally the mixin is used by `Ember.CoreView`, `Ember.ControllerMixin`,
* and `Ember.Route` and available to the above classes through
* inheritance.)
*/
class ActionHandler {
/**
* The collection of functions, keyed by name, available on this
* `ActionHandler` as action targets.
*/
actions: {};
/**
* Triggers a named action on the `ActionHandler`. Any parameters
* supplied after the `actionName` string will be passed as arguments
* to the action target function.
*/
send(actionName: string, context: any): any;
}
/**
* This mixin implements Observer-friendly Array-like behavior. It is not a
* concrete implementation, but it can be used up by other classes that want
* to appear like arrays.
*/
class Array implements Enumerable {
/**
* __Required.__ You must implement this method to apply this mixin.
*/
length: number;
/**
* Returns the object at the given `index`. If the given `index` is negative
* or is greater or equal than the array length, returns `undefined`.
*/
objectAt(idx: number): any;
/**
* This returns the objects at the specified indexes, using `objectAt`.
*/
objectsAt(indexes: any[]): any[];
/**
* This is the handler for the special array content property. If you get
* this property, it will return this. If you set this property to a new
* array, it will replace the current content.
*/
'[]': any;
/**
* Returns a new array that is a slice of the receiver. This implementation
* uses the observable array methods to retrieve the objects for the new
* slice.
*/
slice(beginIndex: number, endIndex: number): any[];
/**
* Returns the index of the given object's first occurrence.
* If no `startAt` argument is given, the starting location to
* search is 0. If it's negative, will count backward from
* the end of the array. Returns -1 if no match is found.
*/
indexOf(object: {}, startAt: number): number;
/**
* Returns the index of the given object's last occurrence.
* If no `startAt` argument is given, the search starts from
* the last position. If it's negative, will count backward
* from the end of the array. Returns -1 if no match is found.
*/
lastIndexOf(object: {}, startAt: number): number;
/**
* Adds an array observer to the receiving array. The array observer object
* normally must implement two methods:
*/
addArrayObserver(target: {}, opts: {}): Ember.Array;
/**
* Removes an array observer from the object if the observer is current
* registered. Calling this method multiple times with the same object will
* have no effect.
*/
removeArrayObserver(target: {}, opts: {}): Ember.Array;
/**
* Becomes true whenever the array currently has observers watching changes
* on the array.
*/
hasArrayObservers: boolean;
/**
* If you are implementing an object that supports `Ember.Array`, call this
* method just before the array content changes to notify any observers and
* invalidate any related properties. Pass the starting index of the change
* as well as a delta of the amounts to change.
*/
arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): Ember.Array;
/**
* If you are implementing an object that supports `Ember.Array`, call this
* method just after the array content changes to notify any observers and
* invalidate any related properties. Pass the starting index of the change
* as well as a delta of the amounts to change.
*/
arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): Ember.Array;
/**
* Returns `true` if the passed object can be found in the array.
* This method is a Polyfill for ES 2016 Array.includes.
* If no `startAt` argument is given, the starting location to
* search is 0. If it's negative, searches from the index of
* `this.length + startAt` by asc.
*/
includes(obj: {}, startAt: number): boolean;
/**
* Returns a special object that can be used to observe individual properties
* on the array. Just get an equivalent property on this object and it will
* return an enumerable that maps automatically to the named key on the
* member objects.
*/
'@each': any;
/**
* Helper method returns the first object from a collection. This is usually
* used by bindings and other parts of the framework to extract a single
* object if the enumerable contains only one item.
*/
firstObject: any;
/**
* Helper method returns the last object from a collection. If your enumerable
* contains only one object, this method should always return that object.
* If your enumerable is empty, this method should return `undefined`.
*/
lastObject: any;
/**
* DEPRECATED: Use `Enumerable#includes` instead. See http://emberjs.com/deprecations/v2.x#toc_enumerable-contains
* Returns `true` if the passed object can be found in the receiver. The
* default version will iterate through the enumerable until the object
* is found. You may want to override this with a more efficient version.
*/
contains(obj: {}): boolean;
/**
* Iterates through the enumerable, calling the passed function on each
* item. This method corresponds to the `forEach()` method defined in
* JavaScript 1.6.
*/
forEach(callback: Function, target: {}): {};
/**
* Alias for `mapBy`
*/
getEach(key: string): any[];
/**
* Sets the value on the named property for each member. This is more
* ergonomic than using other methods defined on this helper. If the object
* implements Ember.Observable, the value will be changed to `set(),` otherwise
* it will be set directly. `null` objects are skipped.
*/
setEach(key: string, value: {}): {};
/**
* Maps all of the items in the enumeration to another value, returning
* a new array. This method corresponds to `map()` defined in JavaScript 1.6.
*/
map(callback: Function, target: {}): any[];
/**
* Similar to map, this specialized function returns the value of the named
* property on all items in the enumeration.
*/
mapBy(key: string): any[];
/**
* Returns an array with all of the items in the enumeration that the passed
* function returns true for. This method corresponds to `filter()` defined in
* JavaScript 1.6.
*/
filter(callback: Function, target: {}): any[];
/**
* Returns an array with all of the items in the enumeration where the passed
* function returns false. This method is the inverse of filter().
*/
reject(callback: Function, target: {}): any[];
/**
* Returns an array with just the items with the matched property. You
* can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to `true`.
*/
filterBy(key: string, value: any): any[];
/**
* Returns an array with the items that do not have truthy values for
* key. You can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to false.
*/
rejectBy(key: string, value: string): any[];
/**
* Returns the first item in the array for which the callback returns true.
* This method works similar to the `filter()` method defined in JavaScript 1.6
* except that it will stop working on the array once a match is found.
*/
find(callback: Function, target: {}): {};
/**
* Returns the first item with a property matching the passed value. You
* can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to `true`.
*/
findBy(key: string, value: string): {};
/**
* Returns `true` if the passed function returns true for every item in the
* enumeration. This corresponds with the `every()` method in JavaScript 1.6.
*/
every(callback: Function, target: {}): boolean;
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for all items in the enumerable. This method is often simpler/faster
* than using a callback.
*/
isEvery(key: string, value: string): boolean;
/**
* Returns `true` if the passed function returns true for any item in the
* enumeration.
*/
any(callback: Function, target: {}): boolean;
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for any item in the enumerable. This method is often simpler/faster
* than using a callback.
*/
isAny(key: string, value: string): boolean;
/**
* This will combine the values of the enumerator into a single value. It
* is a useful way to collect a summary value from an enumeration. This
* corresponds to the `reduce()` method defined in JavaScript 1.8.
*/
reduce(callback: Function, initialValue: {}, reducerProperty: string): {};
/**
* Invokes the named method on every object in the receiver that
* implements it. This method corresponds to the implementation in
* Prototype 1.6.
*/
invoke(methodName: string, ...args: any[]): any[];
/**
* Simply converts the enumerable into a genuine array. The order is not
* guaranteed. Corresponds to the method implemented by Prototype.
*/
toArray(): any[];
/**
* Returns a copy of the array with all `null` and `undefined` elements removed.
*/
compact(): any[];
/**
* Returns a new enumerable that excludes the passed value. The default
* implementation returns an array regardless of the receiver type.
* If the receiver does not contain the value it returns the original enumerable.
*/
without(value: {}): Enumerable;
/**
* Returns a new enumerable that contains only unique values. The default
* implementation returns an array regardless of the receiver type.
*/
uniq(): Enumerable;
/**
* Converts the enumerable into an array and sorts by the keys
* specified in the argument.
*/
sortBy(property: string): any[];
/**
* Returns a new enumerable that contains only items containing a unique property value.
* The default implementation returns an array regardless of the receiver type.
*/
uniqBy(): Enumerable;
}
/**
* This is the object instance returned when you get the `@each` property on an
* array. It uses the unknownProperty handler to automatically create
* EachArray instances for property names.
*/
class EachProxy {
}
/**
* Implements some standard methods for comparing objects. Add this mixin to
* any class you create that can compare its instances.
*/
class Comparable {
}
/**
* Implements some standard methods for copying an object. Add this mixin to
* any object you create that can create a copy of itself. This mixin is
* added automatically to the built-in array.
*/
class Copyable {
}
/**
* This mixin defines the common interface implemented by enumerable objects
* in Ember. Most of these methods follow the standard Array iteration
* API defined up to JavaScript 1.8 (excluding language-specific features that
* cannot be emulated in older versions of JavaScript).
*/
class Enumerable {
/**
* Helper method returns the first object from a collection. This is usually
* used by bindings and other parts of the framework to extract a single
* object if the enumerable contains only one item.
*/
firstObject: any;
/**
* Helper method returns the last object from a collection. If your enumerable
* contains only one object, this method should always return that object.
* If your enumerable is empty, this method should return `undefined`.
*/
lastObject: any;
/**
* DEPRECATED: Use `Enumerable#includes` instead. See http://emberjs.com/deprecations/v2.x#toc_enumerable-contains
* Returns `true` if the passed object can be found in the receiver. The
* default version will iterate through the enumerable until the object
* is found. You may want to override this with a more efficient version.
*/
contains(obj: {}): boolean;
/**
* Iterates through the enumerable, calling the passed function on each
* item. This method corresponds to the `forEach()` method defined in
* JavaScript 1.6.
*/
forEach(callback: Function, target: {}): {};
/**
* Alias for `mapBy`
*/
getEach(key: string): any[];
/**
* Sets the value on the named property for each member. This is more
* ergonomic than using other methods defined on this helper. If the object
* implements Ember.Observable, the value will be changed to `set(),` otherwise
* it will be set directly. `null` objects are skipped.
*/
setEach(key: string, value: {}): {};
/**
* Maps all of the items in the enumeration to another value, returning
* a new array. This method corresponds to `map()` defined in JavaScript 1.6.
*/
map(callback: Function, target: {}): any[];
/**
* Similar to map, this specialized function returns the value of the named
* property on all items in the enumeration.
*/
mapBy(key: string): any[];
/**
* Returns an array with all of the items in the enumeration that the passed
* function returns true for. This method corresponds to `filter()` defined in
* JavaScript 1.6.
*/
filter(callback: Function, target: {}): any[];
/**
* Returns an array with all of the items in the enumeration where the passed
* function returns false. This method is the inverse of filter().
*/
reject(callback: Function, target: {}): any[];
/**
* Returns an array with just the items with the matched property. You
* can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to `true`.
*/
filterBy(key: string, value: any): any[];
/**
* Returns an array with the items that do not have truthy values for
* key. You can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to false.
*/
rejectBy(key: string, value: string): any[];
/**
* Returns the first item in the array for which the callback returns true.
* This method works similar to the `filter()` method defined in JavaScript 1.6
* except that it will stop working on the array once a match is found.
*/
find(callback: Function, target: {}): {};
/**
* Returns the first item with a property matching the passed value. You
* can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to `true`.
*/
findBy(key: string, value: string): {};
/**
* Returns `true` if the passed function returns true for every item in the
* enumeration. This corresponds with the `every()` method in JavaScript 1.6.
*/
every(callback: Function, target: {}): boolean;
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for all items in the enumerable. This method is often simpler/faster
* than using a callback.
*/
isEvery(key: string, value: string): boolean;
/**
* Returns `true` if the passed function returns true for any item in the
* enumeration.
*/
any(callback: Function, target: {}): boolean;
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for any item in the enumerable. This method is often simpler/faster
* than using a callback.
*/
isAny(key: string, value: string): boolean;
/**
* This will combine the values of the enumerator into a single value. It
* is a useful way to collect a summary value from an enumeration. This
* corresponds to the `reduce()` method defined in JavaScript 1.8.
*/
reduce(callback: Function, initialValue: {}, reducerProperty: string): {};
/**
* Invokes the named method on every object in the receiver that
* implements it. This method corresponds to the implementation in
* Prototype 1.6.
*/
invoke(methodName: string, ...args: any[]): any[];
/**
* Simply converts the enumerable into a genuine array. The order is not
* guaranteed. Corresponds to the method implemented by Prototype.
*/
toArray(): any[];
/**
* Returns a copy of the array with all `null` and `undefined` elements removed.
*/
compact(): any[];
/**
* Returns a new enumerable that excludes the passed value. The default
* implementation returns an array regardless of the receiver type.
* If the receiver does not contain the value it returns the original enumerable.
*/
without(value: {}): Enumerable;
/**
* Returns a new enumerable that contains only unique values. The default
* implementation returns an array regardless of the receiver type.
*/
uniq(): Enumerable;
/**
* Converts the enumerable into an array and sorts by the keys
* specified in the argument.
*/
sortBy(property: string): any[];
/**
* Returns a new enumerable that contains only items containing a unique property value.
* The default implementation returns an array regardless of the receiver type.
*/
uniqBy(): Enumerable;
/**
* Returns `true` if the passed object can be found in the enumerable.
*/
includes(obj: {}): boolean;
}
/**
* This mixin allows for Ember objects to subscribe to and emit events.
*/
class Evented {
/**
* Subscribes to a named event with given function.
*/
on(name: string, target: {}, method: Function): void;
/**
* Subscribes a function to a named event and then cancels the subscription
* after the first time the event is triggered. It is good to use ``one`` when
* you only care about the first time an event has taken place.
*/
one(name: string, target: {}, method: Function): void;
/**
* Triggers a named event for the object. Any additional arguments
* will be passed as parameters to the functions that are subscribed to the
* event.
*/
trigger(name: string, ...args: any[]): any;
/**
* Cancels subscription for given name, target, and method.
*/
off(name: string, target: {}, method: Function): void;
/**
* Checks to see if object has any subscriptions for named event.
*/
has(name: string): boolean;
}
/**
* DEPRECATED: Use `Object.freeze` instead.
* The `Ember.Freezable` mixin implements some basic methods for marking an
* object as frozen. Once an object is frozen it should be read only. No changes
* may be made the internal state of the object.
*/
class Freezable {
}
/**
* This mixin defines the API for modifying array-like objects. These methods
* can be applied only to a collection that keeps its items in an ordered set.
* It builds upon the Array mixin and adds methods to modify the array.
* One concrete implementations of this class include ArrayProxy.
*/
class MutableArray implements Ember.Array, MutableEnumerable {
/**
* __Required.__ You must implement this method to apply this mixin.
*/
replace(idx: number, amt: number, objects: any[]): any;
/**
* Remove all elements from the array. This is useful if you
* want to reuse an existing array without having to recreate it.
*/
clear(): Ember.Array;
/**
* This will use the primitive `replace()` method to insert an object at the
* specified index.
*/
insertAt(idx: number, object: {}): Ember.Array;
/**
* Remove an object at the specified index using the `replace()` primitive
* method. You can pass either a single index, or a start and a length.
*/
removeAt(start: number, len: number): Ember.Array;
/**
* Push the object onto the end of the array. Works just like `push()` but it
* is KVO-compliant.
*/
pushObject(obj: any): void;
/**
* Add the objects in the passed numerable to the end of the array. Defers
* notifying observers of the change until all objects are added.
*/
pushObjects(objects: Enumerable): Ember.Array;
/**
* Pop object from array or nil if none are left. Works just like `pop()` but
* it is KVO-compliant.
*/
popObject(): void;
/**
* Shift an object from start of array or nil if none are left. Works just
* like `shift()` but it is KVO-compliant.
*/
shiftObject(): void;
/**
* Unshift an object to start of array. Works just like `unshift()` but it is
* KVO-compliant.
*/
unshiftObject(obj: any): void;
/**
* Adds the named objects to the beginning of the array. Defers notifying
* observers until all objects have been added.
*/
unshiftObjects(objects: Enumerable): Ember.Array;
/**
* Reverse objects in the array. Works just like `reverse()` but it is
* KVO-compliant.
*/
reverseObjects(): Ember.Array;
/**
* Replace all the receiver's content with content of the argument.
* If argument is an empty array receiver will be cleared.
*/
setObjects(objects: Ember.Array): Ember.Array;
/**
* Remove all occurrences of an object in the array.
*/
removeObject(obj: any): Ember.Array;
/**
* Push the object onto the end of the array if it is not already
* present in the array.
*/
addObject(obj: any): Ember.Array;
/**
* __Required.__ You must implement this method to apply this mixin.
*/
length: number;
/**
* Returns the object at the given `index`. If the given `index` is negative
* or is greater or equal than the array length, returns `undefined`.
*/
objectAt(idx: number): any;
/**
* This returns the objects at the specified indexes, using `objectAt`.
*/
objectsAt(indexes: any[]): any[];
/**
* This is the handler for the special array content property. If you get
* this property, it will return this. If you set this property to a new
* array, it will replace the current content.
*/
'[]': any;
/**
* Returns a new array that is a slice of the receiver. This implementation
* uses the observable array methods to retrieve the objects for the new
* slice.
*/
slice(beginIndex: number, endIndex: number): any[];
/**
* Returns the index of the given object's first occurrence.
* If no `startAt` argument is given, the starting location to
* search is 0. If it's negative, will count backward from
* the end of the array. Returns -1 if no match is found.
*/
indexOf(object: {}, startAt: number): number;
/**
* Returns the index of the given object's last occurrence.
* If no `startAt` argument is given, the search starts from
* the last position. If it's negative, will count backward
* from the end of the array. Returns -1 if no match is found.
*/
lastIndexOf(object: {}, startAt: number): number;
/**
* Adds an array observer to the receiving array. The array observer object
* normally must implement two methods:
*/
addArrayObserver(target: {}, opts: {}): Ember.Array;
/**
* Removes an array observer from the object if the observer is current
* registered. Calling this method multiple times with the same object will
* have no effect.
*/
removeArrayObserver(target: {}, opts: {}): Ember.Array;
/**
* Becomes true whenever the array currently has observers watching changes
* on the array.
*/
hasArrayObservers: boolean;
/**
* If you are implementing an object that supports `Ember.Array`, call this
* method just before the array content changes to notify any observers and
* invalidate any related properties. Pass the starting index of the change
* as well as a delta of the amounts to change.
*/
arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): Ember.Array;
/**
* If you are implementing an object that supports `Ember.Array`, call this
* method just after the array content changes to notify any observers and
* invalidate any related properties. Pass the starting index of the change
* as well as a delta of the amounts to change.
*/
arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): Ember.Array;
/**
* Returns `true` if the passed object can be found in the array.
* This method is a Polyfill for ES 2016 Array.includes.
* If no `startAt` argument is given, the starting location to
* search is 0. If it's negative, searches from the index of
* `this.length + startAt` by asc.
*/
includes(obj: {}, startAt: number): boolean;
/**
* Returns a special object that can be used to observe individual properties
* on the array. Just get an equivalent property on this object and it will
* return an enumerable that maps automatically to the named key on the
* member objects.
*/
'@each': any;
/**
* Helper method returns the first object from a collection. This is usually
* used by bindings and other parts of the framework to extract a single
* object if the enumerable contains only one item.
*/
firstObject: any;
/**
* Helper method returns the last object from a collection. If your enumerable
* contains only one object, this method should always return that object.
* If your enumerable is empty, this method should return `undefined`.
*/
lastObject: any;
/**
* DEPRECATED: Use `Enumerable#includes` instead. See http://emberjs.com/deprecations/v2.x#toc_enumerable-contains
* Returns `true` if the passed object can be found in the receiver. The
* default version will iterate through the enumerable until the object
* is found. You may want to override this with a more efficient version.
*/
contains(obj: {}): boolean;
/**
* Iterates through the enumerable, calling the passed function on each
* item. This method corresponds to the `forEach()` method defined in
* JavaScript 1.6.
*/
forEach(callback: Function, target: {}): {};
/**
* Alias for `mapBy`
*/
getEach(key: string): any[];
/**
* Sets the value on the named property for each member. This is more
* ergonomic than using other methods defined on this helper. If the object
* implements Ember.Observable, the value will be changed to `set(),` otherwise
* it will be set directly. `null` objects are skipped.
*/
setEach(key: string, value: {}): {};
/**
* Maps all of the items in the enumeration to another value, returning
* a new array. This method corresponds to `map()` defined in JavaScript 1.6.
*/
map(callback: Function, target: {}): any[];
/**
* Similar to map, this specialized function returns the value of the named
* property on all items in the enumeration.
*/
mapBy(key: string): any[];
/**
* Returns an array with all of the items in the enumeration that the passed
* function returns true for. This method corresponds to `filter()` defined in
* JavaScript 1.6.
*/
filter(callback: Function, target: {}): any[];
/**
* Returns an array with all of the items in the enumeration where the passed
* function returns false. This method is the inverse of filter().
*/
reject(callback: Function, target: {}): any[];
/**
* Returns an array with just the items with the matched property. You
* can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to `true`.
*/
filterBy(key: string, value: any): any[];
/**
* Returns an array with the items that do not have truthy values for
* key. You can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to false.
*/
rejectBy(key: string, value: string): any[];
/**
* Returns the first item in the array for which the callback returns true.
* This method works similar to the `filter()` method defined in JavaScript 1.6
* except that it will stop working on the array once a match is found.
*/
find(callback: Function, target: {}): {};
/**
* Returns the first item with a property matching the passed value. You
* can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to `true`.
*/
findBy(key: string, value: string): {};
/**
* Returns `true` if the passed function returns true for every item in the
* enumeration. This corresponds with the `every()` method in JavaScript 1.6.
*/
every(callback: Function, target: {}): boolean;
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for all items in the enumerable. This method is often simpler/faster
* than using a callback.
*/
isEvery(key: string, value: string): boolean;
/**
* Returns `true` if the passed function returns true for any item in the
* enumeration.
*/
any(callback: Function, target: {}): boolean;
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for any item in the enumerable. This method is often simpler/faster
* than using a callback.
*/
isAny(key: string, value: string): boolean;
/**
* This will combine the values of the enumerator into a single value. It
* is a useful way to collect a summary value from an enumeration. This
* corresponds to the `reduce()` method defined in JavaScript 1.8.
*/
reduce(callback: Function, initialValue: {}, reducerProperty: string): {};
/**
* Invokes the named method on every object in the receiver that
* implements it. This method corresponds to the implementation in
* Prototype 1.6.
*/
invoke(methodName: string, ...args: any[]): any[];
/**
* Simply converts the enumerable into a genuine array. The order is not
* guaranteed. Corresponds to the method implemented by Prototype.
*/
toArray(): any[];
/**
* Returns a copy of the array with all `null` and `undefined` elements removed.
*/
compact(): any[];
/**
* Returns a new enumerable that excludes the passed value. The default
* implementation returns an array regardless of the receiver type.
* If the receiver does not contain the value it returns the original enumerable.
*/
without(value: {}): Enumerable;
/**
* Returns a new enumerable that contains only unique values. The default
* implementation returns an array regardless of the receiver type.
*/
uniq(): Enumerable;
/**
* Converts the enumerable into an array and sorts by the keys
* specified in the argument.
*/
sortBy(property: string): any[];
/**
* Returns a new enumerable that contains only items containing a unique property value.
* The default implementation returns an array regardless of the receiver type.
*/
uniqBy(): Enumerable;
/**
* Adds each object in the passed enumerable to the receiver.
*/
addObjects(objects: Enumerable): {};
/**
* Removes each object in the passed enumerable from the receiver.
*/
removeObjects(objects: Enumerable): {};
}
/**
* This mixin defines the API for modifying generic enumerables. These methods
* can be applied to an object regardless of whether it is ordered or
* unordered.
*/
class MutableEnumerable implements Enumerable {
/**
* __Required.__ You must implement this method to apply this mixin.
*/
addObject(object: {}): {};
/**
* Adds each object in the passed enumerable to the receiver.
*/
addObjects(objects: Enumerable): {};
/**
* __Required.__ You must implement this method to apply this mixin.
*/
removeObject(object: {}): {};
/**
* Removes each object in the passed enumerable from the receiver.
*/
removeObjects(objects: Enumerable): {};
/**
* Helper method returns the first object from a collection. This is usually
* used by bindings and other parts of the framework to extract a single
* object if the enumerable contains only one item.
*/
firstObject: any;
/**
* Helper method returns the last object from a collection. If your enumerable
* contains only one object, this method should always return that object.
* If your enumerable is empty, this method should return `undefined`.
*/
lastObject: any;
/**
* DEPRECATED: Use `Enumerable#includes` instead. See http://emberjs.com/deprecations/v2.x#toc_enumerable-contains
* Returns `true` if the passed object can be found in the receiver. The
* default version will iterate through the enumerable until the object
* is found. You may want to override this with a more efficient version.
*/
contains(obj: {}): boolean;
/**
* Iterates through the enumerable, calling the passed function on each
* item. This method corresponds to the `forEach()` method defined in
* JavaScript 1.6.
*/
forEach(callback: Function, target: {}): {};
/**
* Alias for `mapBy`
*/
getEach(key: string): any[];
/**
* Sets the value on the named property for each member. This is more
* ergonomic than using other methods defined on this helper. If the object
* implements Ember.Observable, the value will be changed to `set(),` otherwise
* it will be set directly. `null` objects are skipped.
*/
setEach(key: string, value: {}): {};
/**
* Maps all of the items in the enumeration to another value, returning
* a new array. This method corresponds to `map()` defined in JavaScript 1.6.
*/
map(callback: Function, target: {}): any[];
/**
* Similar to map, this specialized function returns the value of the named
* property on all items in the enumeration.
*/
mapBy(key: string): any[];
/**
* Returns an array with all of the items in the enumeration that the passed
* function returns true for. This method corresponds to `filter()` defined in
* JavaScript 1.6.
*/
filter(callback: Function, target: {}): any[];
/**
* Returns an array with all of the items in the enumeration where the passed
* function returns false. This method is the inverse of filter().
*/
reject(callback: Function, target: {}): any[];
/**
* Returns an array with just the items with the matched property. You
* can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to `true`.
*/
filterBy(key: string, value: any): any[];
/**
* Returns an array with the items that do not have truthy values for
* key. You can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to false.
*/
rejectBy(key: string, value: string): any[];
/**
* Returns the first item in the array for which the callback returns true.
* This method works similar to the `filter()` method defined in JavaScript 1.6
* except that it will stop working on the array once a match is found.
*/
find(callback: Function, target: {}): {};
/**
* Returns the first item with a property matching the passed value. You
* can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to `true`.
*/
findBy(key: string, value: string): {};
/**
* Returns `true` if the passed function returns true for every item in the
* enumeration. This corresponds with the `every()` method in JavaScript 1.6.
*/
every(callback: Function, target: {}): boolean;
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for all items in the enumerable. This method is often simpler/faster
* than using a callback.
*/
isEvery(key: string, value: string): boolean;
/**
* Returns `true` if the passed function returns true for any item in the
* enumeration.
*/
any(callback: Function, target: {}): boolean;
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for any item in the enumerable. This method is often simpler/faster
* than using a callback.
*/
isAny(key: string, value: string): boolean;
/**
* This will combine the values of the enumerator into a single value. It
* is a useful way to collect a summary value from an enumeration. This
* corresponds to the `reduce()` method defined in JavaScript 1.8.
*/
reduce(callback: Function, initialValue: {}, reducerProperty: string): {};
/**
* Invokes the named method on every object in the receiver that
* implements it. This method corresponds to the implementation in
* Prototype 1.6.
*/
invoke(methodName: string, ...args: any[]): any[];
/**
* Simply converts the enumerable into a genuine array. The order is not
* guaranteed. Corresponds to the method implemented by Prototype.
*/
toArray(): any[];
/**
* Returns a copy of the array with all `null` and `undefined` elements removed.
*/
compact(): any[];
/**
* Returns a new enumerable that excludes the passed value. The default
* implementation returns an array regardless of the receiver type.
* If the receiver does not contain the value it returns the original enumerable.
*/
without(value: {}): Enumerable;
/**
* Returns a new enumerable that contains only unique values. The default
* implementation returns an array regardless of the receiver type.
*/
uniq(): Enumerable;
/**
* Converts the enumerable into an array and sorts by the keys
* specified in the argument.
*/
sortBy(property: string): any[];
/**
* Returns a new enumerable that contains only items containing a unique property value.
* The default implementation returns an array regardless of the receiver type.
*/
uniqBy(): Enumerable;
/**
* Returns `true` if the passed object can be found in the enumerable.
*/
includes(obj: {}): boolean;
}
/**
* ## Overview
*/
class Observable {
/**
* Retrieves the value of a property from the object.
*/
get(keyName: string): {};
/**
* To get the values of multiple properties at once, call `getProperties`
* with a list of strings or an array:
*/
getProperties(...list: string[]): {};
/**
* Sets the provided key or path to the value.
*/
set(keyName: string, value: {}): {};
/**
* Sets a list of properties at once. These properties are set inside
* a single `beginPropertyChanges` and `endPropertyChanges` batch, so
* observers will be buffered.
*/
setProperties(hash: {}): {};
/**
* Convenience method to call `propertyWillChange` and `propertyDidChange` in
* succession.
*/
notifyPropertyChange(keyName: string): Observable;
/**
* Adds an observer on a property.
*/
addObserver(key: string, target: {}, method: string|Function): any;
/**
* Remove an observer you have previously registered on this object. Pass
* the same key, target, and method you passed to `addObserver()` and your
* target will no longer receive notifications.
*/
removeObserver(key: string, target: {}, method: string|Function): any;
/**
* Retrieves the value of a property, or a default value in the case that the
* property returns `undefined`.
*/
getWithDefault(keyName: string, defaultValue: {}): {};
/**
* Set the value of a property to the current value plus some amount.
*/
incrementProperty(keyName: string, increment: number): number;
/**
* Set the value of a property to the current value minus some amount.
*/
decrementProperty(keyName: string, decrement: number): number;
/**
* Set the value of a boolean property to the opposite of its
* current value.
*/
toggleProperty(keyName: string): boolean;
/**
* Returns the cached value of a computed property, if it exists.
* This allows you to inspect the value of a computed property
* without accidentally invoking it if it is intended to be
* generated lazily.
*/
cacheFor(keyName: string): {};
}
/**
* A low level mixin making ObjectProxy promise-aware.
*/
class PromiseProxyMixin {
/**
* If the proxied promise is rejected this will contain the reason
* provided.
*/
reason: any;
/**
* Once the proxied promise has settled this will become `false`.
*/
isPending: any;
/**
* Once the proxied promise has settled this will become `true`.
*/
isSettled: any;
/**
* Will become `true` if the proxied promise is rejected.
*/
isRejected: any;
/**
* Will become `true` if the proxied promise is fulfilled.
*/
isFulfilled: any;
/**
* The promise whose fulfillment value is being proxied by this object.
*/
promise: any;
/**
* An alias to the proxied promise's `then`.
*/
then(callback: Function): Ember.RSVP.Promise;
/**
* An alias to the proxied promise's `catch`.
*/
catch(callback: Function): Ember.RSVP.Promise;
/**
* An alias to the proxied promise's `finally`.
*/
finally(callback: Function): Ember.RSVP.Promise;
}
/**
* `Ember.TargetActionSupport` is a mixin that can be included in a class
* to add a `triggerAction` method with semantics similar to the Handlebars
* `{{action}}` helper. In normal Ember usage, the `{{action}}` helper is
* usually the best choice. This mixin is most often useful when you are
* doing more complex event handling in Components.
*/
class TargetActionSupport extends Mixin {
static create(args: any): TargetActionSupport;
}
/**
* An ArrayProxy wraps any other object that implements `Ember.Array` and/or
* `Ember.MutableArray,` forwarding all requests. This makes it very useful for
* a number of binding use cases or other cases where being able to swap
* out the underlying array is useful.
*/
class ArrayProxy extends Ember.Object implements MutableArray {
/**
* Should actually retrieve the object at the specified index from the
* content. You can override this method in subclasses to transform the
* content item to something new.
*/
objectAtContent(idx: number): {};
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): ArrayProxy;
/**
* __Required.__ You must implement this method to apply this mixin.
*/
replace(idx: number, amt: number, objects: any[]): any;
/**
* Remove all elements from the array. This is useful if you
* want to reuse an existing array without having to recreate it.
*/
clear(): Ember.Array;
/**
* This will use the primitive `replace()` method to insert an object at the
* specified index.
*/
insertAt(idx: number, object: {}): Ember.Array;
/**
* Remove an object at the specified index using the `replace()` primitive
* method. You can pass either a single index, or a start and a length.
*/
removeAt(start: number, len: number): Ember.Array;
/**
* Push the object onto the end of the array. Works just like `push()` but it
* is KVO-compliant.
*/
pushObject(obj: any): void;
/**
* Add the objects in the passed numerable to the end of the array. Defers
* notifying observers of the change until all objects are added.
*/
pushObjects(objects: Enumerable): Ember.Array;
/**
* Pop object from array or nil if none are left. Works just like `pop()` but
* it is KVO-compliant.
*/
popObject(): void;
/**
* Shift an object from start of array or nil if none are left. Works just
* like `shift()` but it is KVO-compliant.
*/
shiftObject(): void;
/**
* Unshift an object to start of array. Works just like `unshift()` but it is
* KVO-compliant.
*/
unshiftObject(obj: any): void;
/**
* Adds the named objects to the beginning of the array. Defers notifying
* observers until all objects have been added.
*/
unshiftObjects(objects: Enumerable): Ember.Array;
/**
* Reverse objects in the array. Works just like `reverse()` but it is
* KVO-compliant.
*/
reverseObjects(): Ember.Array;
/**
* Replace all the receiver's content with content of the argument.
* If argument is an empty array receiver will be cleared.
*/
setObjects(objects: Ember.Array): Ember.Array;
/**
* Remove all occurrences of an object in the array.
*/
removeObject(obj: any): Ember.Array;
/**
* Push the object onto the end of the array if it is not already
* present in the array.
*/
addObject(obj: any): Ember.Array;
/**
* __Required.__ You must implement this method to apply this mixin.
*/
length: number;
/**
* Returns the object at the given `index`. If the given `index` is negative
* or is greater or equal than the array length, returns `undefined`.
*/
objectAt(idx: number): any;
/**
* This returns the objects at the specified indexes, using `objectAt`.
*/
objectsAt(indexes: any[]): any[];
/**
* This is the handler for the special array content property. If you get
* this property, it will return this. If you set this property to a new
* array, it will replace the current content.
*/
'[]': any;
/**
* Returns a new array that is a slice of the receiver. This implementation
* uses the observable array methods to retrieve the objects for the new
* slice.
*/
slice(beginIndex: number, endIndex: number): any[];
/**
* Returns the index of the given object's first occurrence.
* If no `startAt` argument is given, the starting location to
* search is 0. If it's negative, will count backward from
* the end of the array. Returns -1 if no match is found.
*/
indexOf(object: {}, startAt: number): number;
/**
* Returns the index of the given object's last occurrence.
* If no `startAt` argument is given, the search starts from
* the last position. If it's negative, will count backward
* from the end of the array. Returns -1 if no match is found.
*/
lastIndexOf(object: {}, startAt: number): number;
/**
* Adds an array observer to the receiving array. The array observer object
* normally must implement two methods:
*/
addArrayObserver(target: {}, opts: {}): Ember.Array;
/**
* Removes an array observer from the object if the observer is current
* registered. Calling this method multiple times with the same object will
* have no effect.
*/
removeArrayObserver(target: {}, opts: {}): Ember.Array;
/**
* Becomes true whenever the array currently has observers watching changes
* on the array.
*/
hasArrayObservers: boolean;
/**
* If you are implementing an object that supports `Ember.Array`, call this
* method just before the array content changes to notify any observers and
* invalidate any related properties. Pass the starting index of the change
* as well as a delta of the amounts to change.
*/
arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): Ember.Array;
/**
* If you are implementing an object that supports `Ember.Array`, call this
* method just after the array content changes to notify any observers and
* invalidate any related properties. Pass the starting index of the change
* as well as a delta of the amounts to change.
*/
arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): Ember.Array;
/**
* Returns `true` if the passed object can be found in the array.
* This method is a Polyfill for ES 2016 Array.includes.
* If no `startAt` argument is given, the starting location to
* search is 0. If it's negative, searches from the index of
* `this.length + startAt` by asc.
*/
includes(obj: {}, startAt: number): boolean;
/**
* Returns a special object that can be used to observe individual properties
* on the array. Just get an equivalent property on this object and it will
* return an enumerable that maps automatically to the named key on the
* member objects.
*/
'@each': any;
/**
* Helper method returns the first object from a collection. This is usually
* used by bindings and other parts of the framework to extract a single
* object if the enumerable contains only one item.
*/
firstObject: any;
/**
* Helper method returns the last object from a collection. If your enumerable
* contains only one object, this method should always return that object.
* If your enumerable is empty, this method should return `undefined`.
*/
lastObject: any;
/**
* DEPRECATED: Use `Enumerable#includes` instead. See http://emberjs.com/deprecations/v2.x#toc_enumerable-contains
* Returns `true` if the passed object can be found in the receiver. The
* default version will iterate through the enumerable until the object
* is found. You may want to override this with a more efficient version.
*/
contains(obj: {}): boolean;
/**
* Iterates through the enumerable, calling the passed function on each
* item. This method corresponds to the `forEach()` method defined in
* JavaScript 1.6.
*/
forEach(callback: Function, target: {}): {};
/**
* Alias for `mapBy`
*/
getEach(key: string): any[];
/**
* Sets the value on the named property for each member. This is more
* ergonomic than using other methods defined on this helper. If the object
* implements Ember.Observable, the value will be changed to `set(),` otherwise
* it will be set directly. `null` objects are skipped.
*/
setEach(key: string, value: {}): {};
/**
* Maps all of the items in the enumeration to another value, returning
* a new array. This method corresponds to `map()` defined in JavaScript 1.6.
*/
map(callback: Function, target: {}): any[];
/**
* Similar to map, this specialized function returns the value of the named
* property on all items in the enumeration.
*/
mapBy(key: string): any[];
/**
* Returns an array with all of the items in the enumeration that the passed
* function returns true for. This method corresponds to `filter()` defined in
* JavaScript 1.6.
*/
filter(callback: Function, target: {}): any[];
/**
* Returns an array with all of the items in the enumeration where the passed
* function returns false. This method is the inverse of filter().
*/
reject(callback: Function, target: {}): any[];
/**
* Returns an array with just the items with the matched property. You
* can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to `true`.
*/
filterBy(key: string, value: any): any[];
/**
* Returns an array with the items that do not have truthy values for
* key. You can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to false.
*/
rejectBy(key: string, value: string): any[];
/**
* Returns the first item in the array for which the callback returns true.
* This method works similar to the `filter()` method defined in JavaScript 1.6
* except that it will stop working on the array once a match is found.
*/
find(callback: Function, target: {}): {};
/**
* Returns the first item with a property matching the passed value. You
* can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to `true`.
*/
findBy(key: string, value: string): {};
/**
* Returns `true` if the passed function returns true for every item in the
* enumeration. This corresponds with the `every()` method in JavaScript 1.6.
*/
every(callback: Function, target: {}): boolean;
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for all items in the enumerable. This method is often simpler/faster
* than using a callback.
*/
isEvery(key: string, value: string): boolean;
/**
* Returns `true` if the passed function returns true for any item in the
* enumeration.
*/
any(callback: Function, target: {}): boolean;
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for any item in the enumerable. This method is often simpler/faster
* than using a callback.
*/
isAny(key: string, value: string): boolean;
/**
* This will combine the values of the enumerator into a single value. It
* is a useful way to collect a summary value from an enumeration. This
* corresponds to the `reduce()` method defined in JavaScript 1.8.
*/
reduce(callback: Function, initialValue: {}, reducerProperty: string): {};
/**
* Invokes the named method on every object in the receiver that
* implements it. This method corresponds to the implementation in
* Prototype 1.6.
*/
invoke(methodName: string, ...args: any[]): any[];
/**
* Simply converts the enumerable into a genuine array. The order is not
* guaranteed. Corresponds to the method implemented by Prototype.
*/
toArray(): any[];
/**
* Returns a copy of the array with all `null` and `undefined` elements removed.
*/
compact(): any[];
/**
* Returns a new enumerable that excludes the passed value. The default
* implementation returns an array regardless of the receiver type.
* If the receiver does not contain the value it returns the original enumerable.
*/
without(value: {}): Enumerable;
/**
* Returns a new enumerable that contains only unique values. The default
* implementation returns an array regardless of the receiver type.
*/
uniq(): Enumerable;
/**
* Converts the enumerable into an array and sorts by the keys
* specified in the argument.
*/
sortBy(property: string): any[];
/**
* Returns a new enumerable that contains only items containing a unique property value.
* The default implementation returns an array regardless of the receiver type.
*/
uniqBy(): Enumerable;
/**
* Adds each object in the passed enumerable to the receiver.
*/
addObjects(objects: Enumerable): {};
/**
* Removes each object in the passed enumerable from the receiver.
*/
removeObjects(objects: Enumerable): {};
}
class CoreObject {
/**
* An overridable method called when objects are instantiated. By default,
* does nothing unless it is overridden during class definition.
*/
init(): any;
/**
* Defines the properties that will be concatenated from the superclass
* (instead of overridden).
*/
concatenatedProperties: any[];
/**
* Defines the properties that will be merged from the superclass
* (instead of overridden).
*/
mergedProperties: any[];
/**
* Destroyed object property flag.
*/
isDestroyed: any;
/**
* Destruction scheduled flag. The `destroy()` method has been called.
*/
isDestroying: any;
/**
* Destroys an object by setting the `isDestroyed` flag and removing its
* metadata, which effectively destroys observers and bindings.
*/
destroy(): Ember.Object;
/**
* Override to implement teardown.
*/
willDestroy(): any;
/**
* Returns a string representation which attempts to provide more information
* than Javascript's `toString` typically does, in a generic way for all Ember
* objects.
*/
toString(): string;
/**
* Creates a new subclass.
*/
static extend(mixins: Mixin, args: {}): any;
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): CoreObject;
/**
* Augments a constructor's prototype with additional
* properties and functions:
*/
reopen(): any;
/**
* Augments a constructor's own properties and functions:
*/
reopenClass(): any;
}
/**
* A Namespace is an object usually used to contain other objects or methods
* such as an application or framework. Create a namespace anytime you want
* to define one of these new containers.
*/
class Namespace extends Ember.Object {
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): Namespace;
}
/**
* The NativeArray mixin contains the properties needed to make the native
* Array support Ember.MutableArray and all of its dependent APIs. Unless you
* have `EmberENV.EXTEND_PROTOTYPES` or `EmberENV.EXTEND_PROTOTYPES.Array` set to
* false, this will be applied automatically. Otherwise you can apply the mixin
* at anytime by calling `Ember.NativeArray.apply(Array.prototype)`.
*/
class NativeArray implements MutableArray, Observable, Copyable {
/**
* __Required.__ You must implement this method to apply this mixin.
*/
replace(idx: number, amt: number, objects: any[]): any;
/**
* Remove all elements from the array. This is useful if you
* want to reuse an existing array without having to recreate it.
*/
clear(): Ember.Array;
/**
* This will use the primitive `replace()` method to insert an object at the
* specified index.
*/
insertAt(idx: number, object: {}): Ember.Array;
/**
* Remove an object at the specified index using the `replace()` primitive
* method. You can pass either a single index, or a start and a length.
*/
removeAt(start: number, len: number): Ember.Array;
/**
* Push the object onto the end of the array. Works just like `push()` but it
* is KVO-compliant.
*/
pushObject(obj: any): void;
/**
* Add the objects in the passed numerable to the end of the array. Defers
* notifying observers of the change until all objects are added.
*/
pushObjects(objects: Enumerable): Ember.Array;
/**
* Pop object from array or nil if none are left. Works just like `pop()` but
* it is KVO-compliant.
*/
popObject(): void;
/**
* Shift an object from start of array or nil if none are left. Works just
* like `shift()` but it is KVO-compliant.
*/
shiftObject(): void;
/**
* Unshift an object to start of array. Works just like `unshift()` but it is
* KVO-compliant.
*/
unshiftObject(obj: any): void;
/**
* Adds the named objects to the beginning of the array. Defers notifying
* observers until all objects have been added.
*/
unshiftObjects(objects: Enumerable): Ember.Array;
/**
* Reverse objects in the array. Works just like `reverse()` but it is
* KVO-compliant.
*/
reverseObjects(): Ember.Array;
/**
* Replace all the receiver's content with content of the argument.
* If argument is an empty array receiver will be cleared.
*/
setObjects(objects: Ember.Array): Ember.Array;
/**
* Remove all occurrences of an object in the array.
*/
removeObject(obj: any): Ember.Array;
/**
* Push the object onto the end of the array if it is not already
* present in the array.
*/
addObject(obj: any): Ember.Array;
/**
* __Required.__ You must implement this method to apply this mixin.
*/
length: number;
/**
* Returns the object at the given `index`. If the given `index` is negative
* or is greater or equal than the array length, returns `undefined`.
*/
objectAt(idx: number): any;
/**
* This returns the objects at the specified indexes, using `objectAt`.
*/
objectsAt(indexes: any[]): any[];
/**
* This is the handler for the special array content property. If you get
* this property, it will return this. If you set this property to a new
* array, it will replace the current content.
*/
'[]': any;
/**
* Returns a new array that is a slice of the receiver. This implementation
* uses the observable array methods to retrieve the objects for the new
* slice.
*/
slice(beginIndex: number, endIndex: number): any[];
/**
* Returns the index of the given object's first occurrence.
* If no `startAt` argument is given, the starting location to
* search is 0. If it's negative, will count backward from
* the end of the array. Returns -1 if no match is found.
*/
indexOf(object: {}, startAt: number): number;
/**
* Returns the index of the given object's last occurrence.
* If no `startAt` argument is given, the search starts from
* the last position. If it's negative, will count backward
* from the end of the array. Returns -1 if no match is found.
*/
lastIndexOf(object: {}, startAt: number): number;
/**
* Adds an array observer to the receiving array. The array observer object
* normally must implement two methods:
*/
addArrayObserver(target: {}, opts: {}): Ember.Array;
/**
* Removes an array observer from the object if the observer is current
* registered. Calling this method multiple times with the same object will
* have no effect.
*/
removeArrayObserver(target: {}, opts: {}): Ember.Array;
/**
* Becomes true whenever the array currently has observers watching changes
* on the array.
*/
hasArrayObservers: boolean;
/**
* If you are implementing an object that supports `Ember.Array`, call this
* method just before the array content changes to notify any observers and
* invalidate any related properties. Pass the starting index of the change
* as well as a delta of the amounts to change.
*/
arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): Ember.Array;
/**
* If you are implementing an object that supports `Ember.Array`, call this
* method just after the array content changes to notify any observers and
* invalidate any related properties. Pass the starting index of the change
* as well as a delta of the amounts to change.
*/
arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): Ember.Array;
/**
* Returns `true` if the passed object can be found in the array.
* This method is a Polyfill for ES 2016 Array.includes.
* If no `startAt` argument is given, the starting location to
* search is 0. If it's negative, searches from the index of
* `this.length + startAt` by asc.
*/
includes(obj: {}, startAt: number): boolean;
/**
* Returns a special object that can be used to observe individual properties
* on the array. Just get an equivalent property on this object and it will
* return an enumerable that maps automatically to the named key on the
* member objects.
*/
'@each': any;
/**
* Helper method returns the first object from a collection. This is usually
* used by bindings and other parts of the framework to extract a single
* object if the enumerable contains only one item.
*/
firstObject: any;
/**
* Helper method returns the last object from a collection. If your enumerable
* contains only one object, this method should always return that object.
* If your enumerable is empty, this method should return `undefined`.
*/
lastObject: any;
/**
* DEPRECATED: Use `Enumerable#includes` instead. See http://emberjs.com/deprecations/v2.x#toc_enumerable-contains
* Returns `true` if the passed object can be found in the receiver. The
* default version will iterate through the enumerable until the object
* is found. You may want to override this with a more efficient version.
*/
contains(obj: {}): boolean;
/**
* Iterates through the enumerable, calling the passed function on each
* item. This method corresponds to the `forEach()` method defined in
* JavaScript 1.6.
*/
forEach(callback: Function, target: {}): {};
/**
* Alias for `mapBy`
*/
getEach(key: string): any[];
/**
* Sets the value on the named property for each member. This is more
* ergonomic than using other methods defined on this helper. If the object
* implements Ember.Observable, the value will be changed to `set(),` otherwise
* it will be set directly. `null` objects are skipped.
*/
setEach(key: string, value: {}): {};
/**
* Maps all of the items in the enumeration to another value, returning
* a new array. This method corresponds to `map()` defined in JavaScript 1.6.
*/
map(callback: Function, target: {}): any[];
/**
* Similar to map, this specialized function returns the value of the named
* property on all items in the enumeration.
*/
mapBy(key: string): any[];
/**
* Returns an array with all of the items in the enumeration that the passed
* function returns true for. This method corresponds to `filter()` defined in
* JavaScript 1.6.
*/
filter(callback: Function, target: {}): any[];
/**
* Returns an array with all of the items in the enumeration where the passed
* function returns false. This method is the inverse of filter().
*/
reject(callback: Function, target: {}): any[];
/**
* Returns an array with just the items with the matched property. You
* can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to `true`.
*/
filterBy(key: string, value: any): any[];
/**
* Returns an array with the items that do not have truthy values for
* key. You can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to false.
*/
rejectBy(key: string, value: string): any[];
/**
* Returns the first item in the array for which the callback returns true.
* This method works similar to the `filter()` method defined in JavaScript 1.6
* except that it will stop working on the array once a match is found.
*/
find(callback: Function, target: {}): {};
/**
* Returns the first item with a property matching the passed value. You
* can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to `true`.
*/
findBy(key: string, value: string): {};
/**
* Returns `true` if the passed function returns true for every item in the
* enumeration. This corresponds with the `every()` method in JavaScript 1.6.
*/
every(callback: Function, target: {}): boolean;
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for all items in the enumerable. This method is often simpler/faster
* than using a callback.
*/
isEvery(key: string, value: string): boolean;
/**
* Returns `true` if the passed function returns true for any item in the
* enumeration.
*/
any(callback: Function, target: {}): boolean;
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for any item in the enumerable. This method is often simpler/faster
* than using a callback.
*/
isAny(key: string, value: string): boolean;
/**
* This will combine the values of the enumerator into a single value. It
* is a useful way to collect a summary value from an enumeration. This
* corresponds to the `reduce()` method defined in JavaScript 1.8.
*/
reduce(callback: Function, initialValue: {}, reducerProperty: string): {};
/**
* Invokes the named method on every object in the receiver that
* implements it. This method corresponds to the implementation in
* Prototype 1.6.
*/
invoke(methodName: string, ...args: any[]): any[];
/**
* Simply converts the enumerable into a genuine array. The order is not
* guaranteed. Corresponds to the method implemented by Prototype.
*/
toArray(): any[];
/**
* Returns a copy of the array with all `null` and `undefined` elements removed.
*/
compact(): any[];
/**
* Returns a new enumerable that excludes the passed value. The default
* implementation returns an array regardless of the receiver type.
* If the receiver does not contain the value it returns the original enumerable.
*/
without(value: {}): Enumerable;
/**
* Returns a new enumerable that contains only unique values. The default
* implementation returns an array regardless of the receiver type.
*/
uniq(): Enumerable;
/**
* Converts the enumerable into an array and sorts by the keys
* specified in the argument.
*/
sortBy(property: string): any[];
/**
* Returns a new enumerable that contains only items containing a unique property value.
* The default implementation returns an array regardless of the receiver type.
*/
uniqBy(): Enumerable;
/**
* Adds each object in the passed enumerable to the receiver.
*/
addObjects(objects: Enumerable): {};
/**
* Removes each object in the passed enumerable from the receiver.
*/
removeObjects(objects: Enumerable): {};
/**
* Retrieves the value of a property from the object.
*/
get(keyName: string): {};
/**
* To get the values of multiple properties at once, call `getProperties`
* with a list of strings or an array:
*/
getProperties(...list: string[]): {};
/**
* Sets the provided key or path to the value.
*/
set(keyName: string, value: {}): {};
/**
* Sets a list of properties at once. These properties are set inside
* a single `beginPropertyChanges` and `endPropertyChanges` batch, so
* observers will be buffered.
*/
setProperties(hash: {}): {};
/**
* Convenience method to call `propertyWillChange` and `propertyDidChange` in
* succession.
*/
notifyPropertyChange(keyName: string): Observable;
/**
* Adds an observer on a property.
*/
addObserver(key: string, target: {}, method: string|Function): any;
/**
* Remove an observer you have previously registered on this object. Pass
* the same key, target, and method you passed to `addObserver()` and your
* target will no longer receive notifications.
*/
removeObserver(key: string, target: {}, method: string|Function): any;
/**
* Retrieves the value of a property, or a default value in the case that the
* property returns `undefined`.
*/
getWithDefault(keyName: string, defaultValue: {}): {};
/**
* Set the value of a property to the current value plus some amount.
*/
incrementProperty(keyName: string, increment: number): number;
/**
* Set the value of a property to the current value minus some amount.
*/
decrementProperty(keyName: string, decrement: number): number;
/**
* Set the value of a boolean property to the opposite of its
* current value.
*/
toggleProperty(keyName: string): boolean;
/**
* Returns the cached value of a computed property, if it exists.
* This allows you to inspect the value of a computed property
* without accidentally invoking it if it is intended to be
* generated lazily.
*/
cacheFor(keyName: string): {};
}
/**
* `Ember.Object` is the main base class for all Ember objects. It is a subclass
* of `Ember.CoreObject` with the `Ember.Observable` mixin applied. For details,
* see the documentation for each of these.
*/
class Object extends CoreObject implements Observable {
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): Object;
/**
* Retrieves the value of a property from the object.
*/
get(keyName: string): {};
/**
* To get the values of multiple properties at once, call `getProperties`
* with a list of strings or an array:
*/
getProperties(...list: string[]): {};
/**
* Sets the provided key or path to the value.
*/
set(keyName: string, value: {}): {};
/**
* Sets a list of properties at once. These properties are set inside
* a single `beginPropertyChanges` and `endPropertyChanges` batch, so
* observers will be buffered.
*/
setProperties(hash: {}): {};
/**
* Convenience method to call `propertyWillChange` and `propertyDidChange` in
* succession.
*/
notifyPropertyChange(keyName: string): Observable;
/**
* Adds an observer on a property.
*/
addObserver(key: string, target: {}, method: string|Function): any;
/**
* Remove an observer you have previously registered on this object. Pass
* the same key, target, and method you passed to `addObserver()` and your
* target will no longer receive notifications.
*/
removeObserver(key: string, target: {}, method: string|Function): any;
/**
* Retrieves the value of a property, or a default value in the case that the
* property returns `undefined`.
*/
getWithDefault(keyName: string, defaultValue: {}): {};
/**
* Set the value of a property to the current value plus some amount.
*/
incrementProperty(keyName: string, increment: number): number;
/**
* Set the value of a property to the current value minus some amount.
*/
decrementProperty(keyName: string, decrement: number): number;
/**
* Set the value of a boolean property to the opposite of its
* current value.
*/
toggleProperty(keyName: string): boolean;
/**
* Returns the cached value of a computed property, if it exists.
* This allows you to inspect the value of a computed property
* without accidentally invoking it if it is intended to be
* generated lazily.
*/
cacheFor(keyName: string): {};
}
/**
* `Ember.ObjectProxy` forwards all properties not defined by the proxy itself
* to a proxied `content` object.
*/
class ObjectProxy extends Ember.Object implements ProxyMixin {
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): ObjectProxy;
}
class Service extends Ember.Object {
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): Service;
}
class ActionSupport {
/**
* Calls an action passed to a component.
*/
sendAction(action: string, params: any): any;
}
class ClassNamesSupport {
/**
* Standard CSS class names to apply to the view's outer element. This
* property automatically inherits any class names defined by the view's
* superclasses as well.
*/
classNames: any[];
/**
* A list of properties of the view to apply as class names. If the property
* is a string value, the value of that string will be applied as a class
* name.
*/
classNameBindings: any[];
}
/**
* `TextSupport` is a shared mixin used by both `Ember.TextField` and
* `Ember.TextArea`. `TextSupport` adds a number of methods that allow you to
* specify a controller action to invoke when a certain event is fired on your
* text field or textarea. The specifed controller action would get the current
* value of the field passed in as the only argument unless the value of
* the field is empty. In that case, the instance of the field itself is passed
* in as the only argument.
*/
class TextSupport extends Mixin implements TargetActionSupport {
static create(args: any): TextSupport;
}
class ViewMixin {
/**
* A list of properties of the view to apply as attributes. If the property
* is a string value, the value of that string will be applied as the value
* for an attribute of the property's name.
*/
attributeBindings: any[];
/**
* Renders the view again. This will work regardless of whether the
* view is already in the DOM or not. If the view is in the DOM, the
* rendering process will be deferred to give bindings a chance
* to synchronize.
*/
rerender(): any;
/**
* Returns the current DOM element for the view.
*/
element: DOMElement;
/**
* Returns a jQuery object for this view's element. If you pass in a selector
* string, this method will return a jQuery object, using the current element
* as its buffer.
*/
$(selector: string): JQuery;
/**
* The HTML `id` of the view's element in the DOM. You can provide this
* value yourself but it must be unique (just as in HTML):
*/
elementId: string;
/**
* Called when a view is going to insert an element into the DOM.
*/
willInsertElement(): void;
/**
* Called when the element of the view has been inserted into the DOM.
* Override this function to do any set up that requires an element
* in the document body.
*/
didInsertElement(): void;
/**
* Called when the view is about to rerender, but before anything has
* been torn down. This is a good opportunity to tear down any manual
* observers you have installed based on the DOM state
*/
willClearRender(): void;
/**
* Called when the element of the view is going to be destroyed. Override
* this function to do any teardown that requires an element, like removing
* event listeners.
*/
willDestroyElement(): void;
/**
* Tag name for the view's outer element. The tag name is only used when an
* element is first created. If you change the `tagName` for an element, you
* must destroy and recreate the view element.
*/
tagName: string;
}
/**
* `Ember.EventDispatcher` handles delegating browser events to their
* corresponding `Ember.Views.` For example, when you click on a view,
* `Ember.EventDispatcher` ensures that that view's `mouseDown` method gets
* called.
*/
class EventDispatcher extends Ember.Object {
/**
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): EventDispatcher;
}
/**
* DEPRECATED: Use `Ember.Component` instead.
* `Ember.CoreView` is an abstract class that exists to give view-like behavior
* to both Ember's main view class `Ember.Component` and other classes that don't need
* the full functionality of `Ember.Component`.
*/
class CoreView extends Ember.Object implements Evented, ActionHandler {
/**
* DEPRECATED: Use `Ember.Component` instead.
* Override the default event firing from `Ember.Evented` to
* also call methods with the given name.
*/
trigger(name: string): any;
/**
* DEPRECATED: Use `Ember.Component` instead.
* Creates an instance of a class. Accepts either no arguments, or an object
* containing values to initialize the newly instantiated object with.
*/
static create(args: any): CoreView;
/**
* DEPRECATED: Use `Ember.Component` instead.
* Subscribes to a named event with given function.
*/
on(name: string, target: {}, method: Function): void;
/**
* DEPRECATED: Use `Ember.Component` instead.
* Subscribes a function to a named event and then cancels the subscription
* after the first time the event is triggered. It is good to use ``one`` when
* you only care about the first time an event has taken place.
*/
one(name: string, target: {}, method: Function): void;
/**
* DEPRECATED: Use `Ember.Component` instead.
* Cancels subscription for given name, target, and method.
*/
off(name: string, target: {}, method: Function): void;
/**
* DEPRECATED: Use `Ember.Component` instead.
* Checks to see if object has any subscriptions for named event.
*/
has(name: string): boolean;
/**
* DEPRECATED: Use `Ember.Component` instead.
* The collection of functions, keyed by name, available on this
* `ActionHandler` as action targets.
*/
actions: {};
/**
* DEPRECATED: Use `Ember.Component` instead.
* Triggers a named action on the `ActionHandler`. Any parameters
* supplied after the `actionName` string will be passed as arguments
* to the action target function.
*/
send(actionName: string, context: any): any;
}
}
declare namespace Handlebars {
class SafeString {
}
}
/**
* A Transition is a thennable (a promise-like object) that represents
* an attempt to transition to another route. It can be aborted, either
* explicitly via `abort` or by attempting another transition while a
* previous one is still underway. An aborted transition can also
* be `retry()`d later.
*/
declare class Transition {
/**
* The Transition's internal promise. Calling `.then` on this property
* is that same as calling `.then` on the Transition object itself, but
* this property is exposed for when you want to pass around a
* Transition's promise, but not the Transition object itself, since
* Transition object can be externally `abort`ed, while the promise
* cannot.
*/
promise: {};
/**
* Custom state can be stored on a Transition's `data` object.
* This can be useful for decorating a Transition within an earlier
* hook and shared with a later hook. Properties set on `data` will
* be copied to new transitions generated by calling `retry` on this
* transition.
*/
data: {};
/**
* A standard promise hook that resolves if the transition
* succeeds and rejects if it fails/redirects/aborts.
*/
then(onFulfilled: Function, onRejected: Function, label: string): Promise<any>;
/**
* Forwards to the internal `promise` property which you can
* use in situations where you want to pass around a thennable,
* but not the Transition itself.
*/
catch(onRejection: Function, label: string): Promise<any>;
/**
* Forwards to the internal `promise` property which you can
* use in situations where you want to pass around a thennable,
* but not the Transition itself.
*/
finally(callback: Function, label: string): Promise<any>;
/**
* Aborts the Transition. Note you can also implicitly abort a transition
* by initiating another transition while a previous one is underway.
*/
abort(): Transition;
/**
* Retries a previously-aborted transition (making sure to abort the
* transition if it's still active). Returns a new transition that
* represents the new attempt to transition.
*/
retry(): Transition;
/**
* Sets the URL-changing method to be employed at the end of a
* successful transition. By default, a new Transition will just
* use `updateURL`, but passing 'replace' to this method will
* cause the URL to update using 'replaceWith' instead. Omitting
* a parameter will disable the URL change, allowing for transitions
* that don't update the URL at completion (this is also used for
* handleURL, since the URL has already changed before the
* transition took place).
*/
method(method: string): Transition;
/**
* Fires an event on the current list of resolved/resolving
* handlers within this transition. Useful for firing events
* on route hierarchies that haven't fully been entered yet.
* Note: This method is also aliased as `send`
*/
trigger(ignoreFailure: boolean, name: string): any;
/**
* Transitions are aborted and their promises rejected
* when redirects occur; this method returns a promise
* that will follow any redirects that occur and fulfill
* with the value fulfilled by any redirecting transitions
* that occur.
*/
followRedirects(): Promise<any>;
}
declare class RSVP {
/**
* This is a convenient alias for `RSVP.Promise.all`.
*/
static all(array: any[], label: string): any;
/**
* This is a convenient alias for `RSVP.Promise.race`.
*/
static race(array: any[], label: string): any;
/**
* This is a convenient alias for `RSVP.Promise.reject`.
*/
static reject(reason: any, label: string): Ember.RSVP.Promise;
/**
* This is a convenient alias for `RSVP.Promise.resolve`.
*/
static resolve(value: any, label: string): Ember.RSVP.Promise;
/**
* `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing
* a fail-fast method, it waits until all the promises have returned and
* shows you all the results. This is useful if you want to handle multiple
* promises' failure states together as a set.
*/
static allSettled(entries: any[], label: string): Ember.RSVP.Promise;
/**
* `RSVP.defer` returns an object similar to jQuery's `$.Deferred`.
* `RSVP.defer` should be used when porting over code reliant on `$.Deferred`'s
* interface. New code should use the `RSVP.Promise` constructor instead.
*/
static defer(label: string): {};
/**
* `RSVP.filter` is similar to JavaScript's native `filter` method, except that it
* waits for all promises to become fulfilled before running the `filterFn` on
* each item in given to `promises`. `RSVP.filter` returns a promise that will
* become fulfilled with the result of running `filterFn` on the values the
* promises become fulfilled with.
*/
static filter(promises: any[], filterFn: Function, label: string): Ember.RSVP.Promise;
/**
* `RSVP.hashSettled` is similar to `RSVP.allSettled`, but takes an object
* instead of an array for its `promises` argument.
*/
static hashSettled(object: {}, label: string): Ember.RSVP.Promise;
/**
* `RSVP.hash` is similar to `RSVP.all`, but takes an object instead of an array
* for its `promises` argument.
*/
static hash(object: {}, label: string): Ember.RSVP.Promise;
/**
* `RSVP.map` is similar to JavaScript's native `map` method, except that it
* waits for all promises to become fulfilled before running the `mapFn` on
* each item in given to `promises`. `RSVP.map` returns a promise that will
* become fulfilled with the result of running `mapFn` on the values the promises
* become fulfilled with.
*/
static map(promises: any[], mapFn: Function, label: string): Ember.RSVP.Promise;
/**
* `RSVP.denodeify` takes a 'node-style' function and returns a function that
* will return an `RSVP.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:
*/
static denodeify(nodeFunc: Function, options: boolean|any[]): Function;
/**
* `RSVP.rethrow` will rethrow an error on the next turn of the JavaScript event
* loop in order to aid debugging.
*/
static rethrow(reason: Error): any;
}
/**
* A container used to instantiate and cache objects.
*/
declare class Container {
/**
* Given a fullName, return the corresponding factory. The consumer of the factory
* is responsible for the destruction of any factory instances, as there is no
* way for the container to ensure instances are destroyed when it itself is
* destroyed.
*/
factoryFor(fullName: string, options: {}): any;
}
/**
* A registry used to store factory and option information keyed
* by type.
*/
declare class Registry {
}
/**
* Objects of this type can implement an interface to respond to requests to
* get and set. The default implementation handles simple properties.
*/
declare class Descriptor {
}
/**
* Helper class that allows you to register your library with Ember.
*/
declare class Libraries {
}
/**
* The Routing service is used by LinkComponent, and provides facilities for
* the component/view layer to interact with the router.
*/
declare class RoutingService {
}
/**
* A two-tiered cache with support for fallback values when doing lookups.
* Uses "buckets" and then "keys" to cache values.
*/
declare class BucketCache {
}
declare interface Function {
/**
* The `property` extension of Javascript's Function prototype is available
* when `EmberENV.EXTEND_PROTOTYPES` or `EmberENV.EXTEND_PROTOTYPES.Function` is
* `true`, which is the default.
*/
property(): any;
/**
* The `observes` extension of Javascript's Function prototype is available
* when `EmberENV.EXTEND_PROTOTYPES` or `EmberENV.EXTEND_PROTOTYPES.Function` is
* true, which is the default.
*/
observes(): any;
/**
* The `on` extension of Javascript's Function prototype is available
* when `EmberENV.EXTEND_PROTOTYPES` or `EmberENV.EXTEND_PROTOTYPES.Function` is
* true, which is the default.
*/
on(): any;
}
declare interface String {
}
/**
* Given a fullName return a factory manager.
*/
declare class ContainerProxyMixin {
/**
* Returns an object that can be used to provide an owner to a
* manually created instance.
*/
ownerInjection(): {};
/**
* Given a fullName return a corresponding instance.
*/
lookup(fullName: string, options: {}): any;
}
/**
* RegistryProxyMixin is used to provide public access to specific
* registry functionality.
*/
declare class RegistryProxyMixin {
/**
* Given a fullName return the corresponding factory.
*/
resolveRegistration(fullName: string): Function;
/**
* Registers a factory that can be used for dependency injection (with
* `inject`) or for service lookup. Each factory is registered with
* a full name including two parts: `type:name`.
*/
register(fullName: string, factory: Function, options: {}): any;
/**
* Unregister a factory.
*/
unregister(fullName: string): any;
/**
* Check if a factory is registered.
*/
hasRegistration(fullName: string): boolean;
/**
* Register an option for a particular factory.
*/
registerOption(fullName: string, optionName: string, options: {}): any;
/**
* Return a specific registered option for a particular factory.
*/
registeredOption(fullName: string, optionName: string): {};
/**
* Register options for a particular factory.
*/
registerOptions(fullName: string, options: {}): any;
/**
* Return registered options for a particular factory.
*/
registeredOptions(fullName: string): {};
/**
* Allow registering options for all factories of a type.
*/
registerOptionsForType(type: string, options: {}): any;
/**
* Return the registered options for all factories of a type.
*/
registeredOptionsForType(type: string): {};
/**
* Define a dependency injection onto a specific factory or all factories
* of a type.
*/
inject(factoryNameOrType: string, property: string, injectionName: string): any;
}
declare class Backburner {
}
declare class DOMElement {
}
export default Ember;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment