declarations
Version:
[](https://www.npmjs.com/package/declarations)
1,212 lines (1,141 loc) • 120 kB
TypeScript
// Type definitions for Ember.js 2.7
// Project: http://emberjs.com/
// Definitions by: Jed Mao <https://github.com/jedmao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="../handlebars/handlebars-1.0.0.d.ts" />
declare var Handlebars: HandlebarsStatic;
declare namespace EmberStates {
interface Transition {
targetName: string;
urlMethod: string;
intent: any;
params: {}|any;
pivotHandler: any;
resolveIndex: number;
handlerInfos: any;
resolvedModels: {}|any;
isActive: boolean;
state: any;
queryParams: {}|any;
queryParamsOnly: boolean;
isTransition: boolean;
/**
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: Ember.RSVP.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: any;
/**
A standard promise hook that resolves if the transition
succeeds and rejects if it fails/redirects/aborts.
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.
@arg {Function} onFulfilled
@arg {Function} onRejected
@arg {String} label optional string for labeling the promise. Useful for tooling.
@return {Promise}
*/
then(onFulfilled: Function, onRejected?: Function, label?: string): Ember.RSVP.Promise;
/**
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.
@method catch
@arg {Function} onRejection
@arg {String} label optional string for labeling the promise.
Useful for tooling.
@return {Promise}
*/
catch(onRejection: Function, label?: string): Ember.RSVP.Promise;
/**
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.
@method finally
@arg {Function} callback
@arg {String} label optional string for labeling the promise.
Useful for tooling.
@return {Promise}
*/
finally(callback: Function, label?: string): Ember.RSVP.Promise;
/**
Aborts the Transition. Note you can also implicitly abort a transition
by initiating another transition while a previous one is underway.
*/
abort(): EmberStates.Transition;
normalize(manager: Ember.StateManager, contexts: any[]): void;
/**
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(): EmberStates.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).
@arg {String} method the type of URL-changing method to use
at the end of a transition. Accepted values are 'replace',
falsy values, or any other non-falsy value (which is
interpreted as an updateURL transition).
@return {Transition} this transition
*/
method(method: string): EmberStates.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`
@arg {Boolean} [ignoreFailure=false] a boolean specifying whether unhandled events throw an error
@arg {String} name the name of the event to fire
*/
trigger(ignoreFailure:boolean, eventName: string): void;
/**
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`
@arg {String} name the name of the event to fire
*/
trigger(eventName: string): void;
/**
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.
@return {Promise} a promise that fulfills with the same
value that the final redirecting transition fulfills with
*/
followRedirects(): Ember.RSVP.Promise;
}
}
declare namespace EmberTesting {
namespace Test {
class Adapter {
asyncEnd(): void;
asyncStart(): void;
exception(error: string): void;
}
class QUnitAdapter extends Adapter { }
}
}
interface Function {
observes(...args: string[]): Function;
observesBefore(...args: string[]): Function;
on(...args: string[]): Function;
property(...args: string[]): Function;
}
interface String {
camelize(): string;
capitalize(): string;
classify(): string;
dasherize(): string;
decamelize(): string;
fmt(...args: string[]): string;
htmlSafe(): typeof Handlebars.SafeString;
loc(...args: string[]): string;
underscore(): string;
w(): string[];
}
interface Array<T> {
constructor(arr: any[]): void;
activate(): void;
addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[];
addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[];
any(callback: Function, target?: any): boolean;
anyBy(key: string, value?: string): boolean;
arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[];
arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[];
someProperty(key: string, value?: any): boolean;
clear(): any[];
compact(): any[];
contains(obj: any): boolean;
enumerableContentDidChange(start: number, removing: number, adding: number): any;
enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: number): any;
enumerableContentDidChange(start: number, removing: number, adding: Ember.Enumerable): any;
enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: Ember.Enumerable): any;
enumerableContentDidChange(removing: number, adding: number): any;
enumerableContentDidChange(removing: Ember.Enumerable, adding: number): any;
enumerableContentDidChange(removing: number, adding: Ember.Enumerable): any;
enumerableContentDidChange(removing: Ember.Enumerable, adding: Ember.Enumerable): any;
enumerableContentWillChange(removing: number, adding: number): any[];
enumerableContentWillChange(removing: Ember.Enumerable, adding: number): any[];
enumerableContentWillChange(removing: number, adding: Ember.Enumerable): any[];
enumerableContentWillChange(removing: Ember.Enumerable, adding: Ember.Enumerable): any[];
every(callback: Function, target?: any): boolean;
everyBy(key: string, value?: string): boolean;
everyProperty(key: string, value?: any): boolean;
filter(callback: Function, target?: any): any[];
filterBy(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.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(item, index, enumerable);
```
- `item` is the current item in the iteration.
- `index` is the current index in the iteration.
- `enumerable` is the enumerable object itself.
It should return the `true` to include the item in the results, `false`
otherwise.
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context. This is a good way
to give your iterator function access to the current object.
@function find
@arg callback The callback to execute
@arg {Object} [target] The target object to use
@return {Object} Found item or `undefined`.
*/
find(callback: Function, target?: any): any;
findBy(key: string, value?: string): any;
forEach(callback: Function, target?: any): any;
getEach(key: string): any[];
indexOf(object: any, startAt?: number): number;
insertAt(idx: number, object: any): any[];
invoke(methodName: string, ...args: any[]): any[];
lastIndexOf(object: any, startAt?: number): number;
map(callback: Function, target?: any): any[];
mapBy(key: string): any[];
nextObject(index: number, previousObject: any, context: any): any;
objectAt(idx: number): any;
objectsAt(...args: number[]): any[];
popObject(): any;
pushObject(obj: any): any;
pushObjects(...args: any[]): any[];
reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any;
reject: ItemIndexEnumerableCallbackTarget;
rejectBy(key: string, value?: string): any[];
removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[];
removeAt(start: number, len: number): any;
removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[];
replace(idx: number, amt: number, objects: any[]): void;
reverseObjects(): any[];
setEach(key: string, value?: any): any;
setObjects(objects: any[]): any[];
shiftObject(): any;
slice(beginIndex?: number, endIndex?: number): any[];
some(callback: Function, target?: any): boolean;
toArray(): any[];
uniq(): any[];
unshiftObject(object: any): any;
unshiftObjects(objects: any[]): any[];
without(value: any): any[];
'[]': any[];
'@each': Ember.EachProxy;
Boolean: boolean;
firstObject: any;
hasEnumerableObservers: boolean;
lastObject: any;
addObject(object: any): any;
addObjects(objects: Ember.Enumerable): any[];
removeObject(object: any): any;
removeObjects(objects: Ember.Enumerable): any[];
addObserver: ModifyObserver;
beginPropertyChanges(): any[];
cacheFor(keyName: string): any;
decrementProperty(keyName: string, decrement?: number): number;
endPropertyChanges(): any[];
get(keyName: string): any;
getProperties(...args: string[]): {};
getProperties(keys: string[]): {};
getWithDefault(keyName: string, defaultValue: any): any;
hasObserverFor(key: string): boolean;
incrementProperty(keyName: string, increment?: number): number;
notifyPropertyChange(keyName: string): any[];
propertyDidChange(keyName: string): any[];
propertyWillChange(keyName: string): any[];
removeObserver(key: string, target: any, method: string): Ember.Observable;
removeObserver(key: string, target: any, method: Function): Ember.Observable;
set(keyName: string, value: any): any[];
setProperties(hash: {}): any[];
toggleProperty(keyName: string): any;
copy(deep: boolean): any[];
frozenCopy(): any[];
// 1.3
isAny(key: string, value?: string): boolean;
isEvery(key: string, value?: string): boolean;
}
interface ApplicationCreateArguments {
customEvents?: {};
rootElement?: string;
/**
Basic logging of successful transitions.
**/
LOG_TRANSITIONS?: boolean;
/**
Detailed logging of all routing steps.
**/
LOG_TRANSITIONS_INTERNAL?: boolean;
}
interface ApplicationInitializerArguments {
name?: string;
initialize?: ApplicationInitializerFunction;
}
interface ApplicationInitializerFunction {
(container: Ember.Container, application: Ember.Application): void;
}
interface CoreObjectArguments {
/**
An overridable method called when objects are instantiated. By default, does nothing unless it is
overridden during class definition. NOTE: If you do override init for a framework class like Ember.View
or Ember.ArrayController, be sure to call this._super() in your init declaration! If you don't, Ember
may not have an opportunity to do important setup work, and you'll see strange behavior in your application.
**/
init?: Function;
/**
Override to implement teardown.
**/
willDestroy?: Function;
[propName: string]: any;
}
interface EnumerableConfigurationOptions {
willChange?: boolean ;
didChange?: boolean ;
}
interface ItemIndexEnumerableCallbackTarget {
(callback: ItemIndexEnumerableCallback, target?: any): any[];
}
interface ItemIndexEnumerableCallback {
(item: any, index: number, enumerable: Ember.Enumerable): void;
}
interface ReduceCallback {
(previousValue: any, item: any, index: number, enumerable: Ember.Enumerable): void;
}
interface TransitionsHash {
contexts: any[];
exitStates: Ember.State[];
enterStates: Ember.State[];
resolveState: Ember.State;
}
interface ActionsHash {
willTransition?: Function;
error?: Function;
}
interface DisconnectOutletOptions {
outlet?: string;
parentView?: string;
}
interface RenderOptions {
into?: string;
controller?: string;
model?: any;
outlet?: string;
view?: string;
}
interface ModifyObserver {
(obj: any, path: string, target: any, method?: Function): void;
(obj: any, path: string, target: any, method?: string): void;
(obj: any, path: string, func: Function, method?: Function): void;
(obj: any, path: string, func: Function, method?: string): void;
}
declare namespace Ember {
/**
Alias for jQuery.
**/
// ReSharper disable once DuplicatingLocalDeclaration
var $: JQueryStatic;
/**
Creates an Ember.NativeArray from an Array like object. Does not modify the original object.
Ember.A is not needed if Ember.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 garentee
that Ember.EXTEND_PROTOTYPES will be true.
**/
function A(arr?: any[]): NativeArray;
/**
The Ember.ActionHandler mixin implements support for moving an actions property to an _actions
property at extend time, and adding _actions to the object's mergedProperties list.
**/
class ActionHandlerMixin {
/**
Triggers a named action on the ActionHandler
**/
send(name: string, ...args: any[]): void;
/**
The collection of functions, keyed by name, available on this ActionHandler as action targets.
**/
actions: ActionsHash;
}
/**
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 Namespace {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
Iterate over each computed property for the class, passing its name and any
associated metadata (see metaForProperty) to the callback.
**/
static eachComputedProperty(callback: Function, binding: {}): void;
/**
Returns the original hash that was passed to meta().
@param key property name
**/
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
/**
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(): void;
/**
Use this to defer readiness until some condition is true.
This allows you to perform asynchronous setup logic and defer
booting your application until the setup has finished.
However, if the setup requires a loading UI, it might be better
to use the router for this purpose.
*/
deferReadiness(): void;
/**
defines an injection or typeInjection
**/
inject(factoryNameOrType: string, property: string, injectionName: string): void;
/**
This injects the test helpers into the window's scope. 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`).
Any callbacks registered with `onInjectHelpers` will be called once the
helpers have been injected.
**/
injectTestHelpers(): void;
/**
registers a factory for later injection
@param fullName type:name (e.g., 'model:user')
@param factory (e.g., App.Person)
**/
register(fullName: string, factory: Function, options?: {}): void;
/**
This removes all helpers that have been registered, and resets and functions
that were overridden by the helpers.
**/
removeTestHelpers(): void;
/**
Reset the application. This is typically used only in tests.
**/
reset(): void;
/**
This hook defers the readiness of the application, so that you can start
the app when your tests are ready to run. It also sets the router's
location to 'none', so that the window's location will not be modified
(preventing both accidental leaking of state between tests and interference
with your testing framework).
**/
setupForTesting(): void;
/**
The DOM events for which the event dispatcher should listen.
*/
customEvents: {};
/**
The Ember.EventDispatcher responsible for delegating events to this application's views.
**/
eventDispatcher: EventDispatcher;
/**
Set this to provide an alternate class to Ember.DefaultResolver
**/
resolver: DefaultResolver;
/**
The root DOM element of the Application. This can be specified as an
element or a jQuery-compatible selector string.
This is the element that will be passed to the Application's, eventDispatcher,
which sets up the listeners for event delegation. Every view in your application
should be a child of the element you specify here.
**/
rootElement: HTMLElement;
/**
Called when the Application has become ready.
The call will be delayed until the DOM has become ready.
**/
ready: Function;
/**
Application's router.
**/
Router: Router;
registry: Registry;
}
/**
This module implements Observer-friendly Array-like behavior. This mixin is picked up by the
Array class as well as other controllers, etc. that want to appear to be arrays.
**/
class Array implements Enumerable {
addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[];
addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable;
any(callback: Function, target?: any): boolean;
anyBy(key: string, value?: string): boolean;
arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[];
arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[];
someProperty(key: string, value?: string): boolean;
compact(): any[];
contains(obj: any): boolean;
enumerableContentDidChange(start: number, removing: number, adding: number): any;
enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any;
enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any;
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any;
enumerableContentDidChange(removing: number, adding: number): any;
enumerableContentDidChange(removing: Enumerable, adding: number): any;
enumerableContentDidChange(removing: number, adding: Enumerable): any;
enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any;
enumerableContentWillChange(removing: number, adding: number): Enumerable;
enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable;
enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable;
enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable;
every(callback: Function, target?: any): boolean;
everyBy(key: string, value?: string): boolean;
everyProperty(key: string, value?: string): boolean;
filter(callback: Function, target: any): any[];
filterBy(key: string, value?: string): any[];
find(callback: Function, target?: any): any;
findBy(key: string, value?: string): any;
forEach(callback: Function, target?: any): any;
getEach(key: string): any[];
indexOf(object: any, startAt: number): number;
invoke(methodName: string, ...args: any[]): any[];
lastIndexOf(object: any, startAt: number): number;
map: ItemIndexEnumerableCallbackTarget;
mapBy(key: string): any[];
nextObject(index: number, previousObject: any, context: any): any;
objectAt(idx: number): any;
objectsAt(...args: number[]): any[];
reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any;
reject: ItemIndexEnumerableCallbackTarget;
rejectBy(key: string, value?: string): any[];
removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[];
removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable;
setEach(key: string, value?: any): any;
slice(beginIndex?: number, endIndex?: number): any[];
some(callback: Function, target?: any): boolean;
toArray(): any[];
uniq(): Enumerable;
without(value: any): Enumerable;
'@each': EachProxy;
Boolean: boolean;
'[]': any[];
firstObject: any;
hasEnumerableObservers: boolean;
lastObject: any;
length: number;
}
/**
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 Object implements MutableArray {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
Iterate over each computed property for the class, passing its name and any
associated metadata (see metaForProperty) to the callback.
**/
static eachComputedProperty(callback: Function, binding: {}): void;
/**
Returns the original hash that was passed to meta().
@param key property name
**/
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[];
addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable;
any(callback: Function, target?: any): boolean;
anyBy(key: string, value?: string): boolean;
arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[];
arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[];
someProperty(key: string, value?: string): boolean;
clear(): any[];
compact(): any[];
contains(obj: any): boolean;
enumerableContentDidChange(start: number, removing: number, adding: number): any;
enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any;
enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any;
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any;
enumerableContentDidChange(removing: number, adding: number): any;
enumerableContentDidChange(removing: Enumerable, adding: number): any;
enumerableContentDidChange(removing: number, adding: Enumerable): any;
enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any;
enumerableContentWillChange(removing: number, adding: number): Enumerable;
enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable;
enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable;
enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable;
every(callback: Function, target?: any): boolean;
everyBy(key: string, value?: string): boolean;
everyProperty(key: string, value?: string): boolean;
filter(callback: Function, target: any): any[];
filterBy(key: string, value?: string): any[];
find(callback: Function, target: any): any;
findBy(key: string, value?: string): any;
forEach(callback: Function, target?: any): any;
getEach(key: string): any[];
indexOf(object: any, startAt: number): number;
insertAt(idx: number, object: any): any[];
invoke(methodName: string, ...args: any[]): any[];
lastIndexOf(object: any, startAt: number): number;
map: ItemIndexEnumerableCallbackTarget;
mapBy(key: string): any[];
nextObject(index: number, previousObject: any, context: any): any;
objectAt(idx: number): any;
objectAtContent(idx: number): any;
objectsAt(...args: number[]): any[];
popObject(): any;
pushObject(obj: any): any;
pushObjects(...args: any[]): any[];
reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any;
reject: ItemIndexEnumerableCallbackTarget;
rejectBy(key: string, value?: string): any[];
removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[];
removeAt(start: number, len: number): any;
removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable;
replace(idx: number, amt: number, objects: any[]): any;
replaceContent(idx: number, amt: number, objects: any[]): void;
reverseObjects(): any[];
setEach(key: string, value?: any): any;
setObjects(objects: any[]): any[];
shiftObject(): any;
slice(beginIndex?: number, endIndex?: number): any[];
some(callback: Function, target?: any): boolean;
toArray(): any[];
uniq(): Enumerable;
unshiftObject(object: any): any;
unshiftObjects(objects: any[]): any[];
without(value: any): Enumerable;
'[]': any[];
'@each': EachProxy;
Boolean: boolean;
firstObject: any;
hasEnumerableObservers: boolean;
lastObject: any;
length: number;
addObject(object: any): any;
addObjects(objects: Enumerable): MutableEnumberable;
removeObject(object: any): any;
removeObjects(objects: Enumerable): MutableEnumberable;
}
var BOOTED: boolean;
/**
Connects the properties of two objects so that whenever the value of one property changes,
the other property will be changed also.
**/
class Binding {
constructor(toPath: string, fromPath: string);
connect(obj: any): Binding;
copy(): Binding;
disconnect(): Binding;
from(path: string): Binding;
to(path: string): Binding;
to(pathTuple: any[]): Binding;
toString(): string;
}
class Button extends Component implements TargetActionSupport {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
Iterate over each computed property for the class, passing its name and any
associated metadata (see metaForProperty) to the callback.
**/
static eachComputedProperty(callback: Function, binding: {}): void;
/**
Returns the original hash that was passed to meta().
@param key property name
**/
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
triggerAction(opts: {}): boolean;
}
/**
The internal class used to create text inputs when the {{input}} helper is used
with type of checkbox. See Handlebars.helpers.input for usage details.
**/
class Checkbox extends Component {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
Iterate over each computed property for the class, passing its name and any
associated metadata (see metaForProperty) to the callback.
**/
static eachComputedProperty(callback: Function, binding: {}): void;
/**
Returns the original hash that was passed to meta().
@param key property name
**/
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
}
/**
Implements some standard methods for comparing objects. Add this mixin to any class
you create that can compare its instances.
**/
class Comparable {
compare(a: any, b: any): number;
}
/**
A view that is completely isolated. Property access 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 is passed in.
**/
class Component {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
Iterate over each computed property for the class, passing its name and any
associated metadata (see metaForProperty) to the callback.
**/
static eachComputedProperty(callback: Function, binding: {}): void;
/**
Returns the original hash that was passed to meta().
@param key property name
**/
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
sendAction(action: string, context: any): void;
targetObject: Controller;
}
/**
A computed property transforms an objects function into a property.
By default the function backing the computed property will only be called once and the result
will be cached. You can specify various properties that your computed property is dependent on.
This will force the cached result to be recomputed if the dependencies are modified.
**/
class ComputedProperty {
get(keyName: string): any;
meta(meta: {}): ComputedProperty;
property(...args: string[]): ComputedProperty;
readOnly(): ComputedProperty;
set(keyName: string, newValue: any, oldValue: string): any;
// ReSharper disable UsingOfReservedWord
volatile(): ComputedProperty;
// ReSharper restore UsingOfReservedWord
}
class Container {
constructor(parent: Container);
parent: Container;
children: any[];
owner: any;
ownerInjection(): any;
resolver: Function;
registry: Registry;
cache: {};
typeInjections: {};
injections: {};
child(): Container;
set(object: {}, key: string, value: any): void;
/**
registers a factory for later injection
@param fullName type:name (e.g., 'model:user')
@param factory (e.g., App.Person)
**/
describe(fullName: string): string;
makeToString(factory: any, fullName: string): Function;
lookup(fullName: string, options?: {}): any;
lookupFactory(fullName: string, options?: {}): any;
destroy(): void;
reset(): void;
}
class Controller extends Object implements ControllerMixin {
replaceRoute(name: string, ...args: any[]): void;
transitionToRoute(name: string, ...args: any[]): void;
controllers: {};
model: any;
needs: string[];
queryParams: any;
target: any;
send(name: string, ...args: any[]): void;
actions: ActionsHash;
}
/**
Additional methods for the ControllerMixin.
**/
class ControllerMixin extends ActionHandlerMixin {
replaceRoute(name: string, ...args: any[]): void;
transitionToRoute(name: string, ...args: any[]): void;
controllers: {};
model : any;
needs: string[];
queryParams: any;
target: any;
}
/**
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.
You should generally implement the copy() method to return a copy of the receiver.
Note that frozenCopy() will only work if you also implement Ember.Freezable.
**/
class Copyable {
copy(deep: boolean): Copyable;
frozenCopy(): Copyable;
}
class CoreObject {
/**
An overridable method called when objects are instantiated. By default,
does nothing unless it is overridden during class definition.
@method init
**/
init(): void;
/**
Defines the properties that will be concatenated from the superclass (instead of overridden).
@property concatenatedProperties
@type Array
@default null
**/
concatenatedProperties: any[];
/**
Destroyed object property flag. If this property is true the observers and bindings were
already removed by the effect of calling the destroy() method.
@property isDestroyed
@default false
**/
isDestroyed: boolean;
/**
Destruction scheduled flag. The destroy() method has been called. The object stays intact
until the end of the run loop at which point the isDestroyed flag is set.
@property isDestroying
@default false
**/
isDestroying: boolean;
/**
Destroys an object by setting the `isDestroyed` flag and removing its
metadata, which effectively destroys observers and bindings.
If you try to set a property on a destroyed object, an exception will be
raised.
Note that destruction is scheduled for the end of the run loop and does not
happen immediately. It will set an isDestroying flag immediately.
@method destroy
@return {Ember.Object} receiver
*/
destroy(): CoreObject;
/**
Override to implement teardown.
@method willDestroy
*/
willDestroy(): void;
/**
Returns a string representation which attempts to provide more information than Javascript's toString
typically does, in a generic way for all Ember objects (e.g., "<App.Person:ember1024>").
@method toString
@return {String} string representation
**/
toString(): string;
static isClass: boolean;
static isMethod: boolean;
/**
Creates a new subclass.
@method extend
@static
@param {Object} [args] - Object containing values to use within the new class
**/
static extend<T>(args?: CoreObjectArguments): T;
/**
Creates a new subclass.
@method extend
@static
@param {Mixin} [mixins] - One or more Mixin classes
@param {Object} [args] - Object containing values to use within the new class
**/
static extend<T>(mixins?: Mixin, args?: CoreObjectArguments): T;
/**
Creates a new subclass.
@method extend
@param {Object} [args] - Object containing values to use within the new class
Non-static method because Ember classes aren't currently 'real' TypeScript classes.
**/
extend<T>(args ?: CoreObjectArguments): T;
/**
Creates a new subclass.
@method extend
@param {Mixin} [mixins] - One or more Mixin classes
@param {Object} [args] - Object containing values to use within the new class
Non-static method because Ember classes aren't currently 'real' TypeScript classes.
**/
extend<T>(mixins ? : Mixin, args ?: CoreObjectArguments): T;
/**
Equivalent to doing extend(arguments).create(). If possible use the normal create method instead.
@method createWithMixins
@static
@param [args]
**/
static createWithMixins<T extends {}>(args?: {}): T;
/**
Creates an instance of the class.
@method create
@static
@param [args] - A hash containing values with which to initialize the newly instantiated object.
**/
static create<T extends {}>(args?: {}): T;
/**
Augments a constructor's prototype with additional properties and functions.
To add functions and properties to the constructor itself, see reopenClass.
@method reopen
**/
static reopen<T extends {}>(args?: {}): T;
/**
Augments a constructor's own properties and functions.
To add functions and properties to instances of a constructor by extending the
constructor's prototype see reopen.
@method reopenClass
**/
static reopenClass<T extends {}>(args?: {}): T;
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
Returns the original hash that was passed to meta().
@method metaForProperty
@static
@param key {String} property name
**/
static metaForProperty(key: string): {};
/**
Iterate over each computed property for the class, passing its name and any
associated metadata (see metaForProperty) to the callback.
@method eachComputedProperty
@static
@param {Function} callback
@param {Object} binding
**/
static eachComputedProperty(callback: Function, binding: {}): void;
}
class DAG {
add(name: string): any;
map(name: string, value: any): void;
addEdge(fromName: string, toName: string): void;
topsort(fn: Function): void;
addEdges(name: string, value: any, before: any, after: any): void;
names: any[];
vertices: {};
}
function DEFAULT_GETTER_FUNCTION(name: string): Function;
/**
The DefaultResolver defines the default lookup rules to resolve container lookups before consulting
the container for registered items:
templates are looked up on Ember.TEMPLATES
other names are looked up on the application after converting the name.
For example, controller:post looks up App.PostController by default.
**/
class DefaultResolver {
resolve(fullName: string): {};
namespace: Application;
}
/**
Objects of this type can implement an interface to respond to requests to get and set.
The default implementation handles simple properties.
You generally won't need to create or subclass this directly.
**/
class Descriptor { }
namespace ENV {
export var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES;
export var LOG_BINDINGS: boolean;
export var LOG_STACKTRACE_ON_DEPRECATION: boolean;
export var LOG_VERSION: boolean;
export var MODEL_FACTORY_INJECTIONS: boolean;
export var RAISE_ON_DEPRECATION: boolean;
}
namespace EXTEND_PROTOTYPES {
export var Array: boolean;
export var Function: boolean;
export var String: boolean;
}
/**
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 extends Object {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
Iterate over each computed property for the class, passing its name and any
associated metadata (see metaForProperty) to the callback.
**/
static eachComputedProperty(callback: Function, binding: {}): void;
/**
Returns the original hash that was passed to meta().
@param key property name
**/
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
unknownProperty(keyName: string, value: any): any[];
}
/**
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).
This mixin is applied automatically to the Array class on page load, so you can use any of these methods
on simple arrays. If Array already implements one of these methods, the mixin will not override them.
**/
class Enumerable {
addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable;
any(callback: Function, target?: any): boolean;
anyBy(key: string, value?: string): boolean;
someProperty(key: string, value?: string): boolean;
compact(): any[];
contains(obj: any): boolean;
enumerableContentDidChange(start: number, removing: number, adding: number): any;
enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any;
enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any;
enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any;
enumerableContentDidChange(removing: number, adding: number): any;
enumerableContentDidChange(removing: Enumerable, adding: number): any;
enumerableContentDidChange(removing: number, adding: Enumerable): any;
enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any;
enumerableContentWillChange(removing: number, adding: number): Enumerable;
enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable;
enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable;
enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable;
every(callback: Function, target?: any): boolean;
everyBy(key: string, value?: string): boolean;
everyProperty(key: string, value?: string): boolean;
filter(callback: Function, target: any): any[];
filterBy(key: string, value?: string): any[];
find(callback: Function, target: any): any;
findBy(key: string, value?: string): any;
forEach(callback: Function, target?: any): any;
getEach(key: string): any[];
invoke(methodName: string, ...args: any[]): any[];
map: ItemIndexEnumerableCallbackTarget;
mapBy(key: string): any[];
nextObject(index: number, previousObject: any, context: any): any;
reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any;
reject: ItemIndexEnumerableCallbackTarget;
rejectBy(key: string, value?: string): any[];
removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable;
setEach(key: string, value?: any): any;
some(callback: Function, target?: any): boolean;
toArray(): any[];
uniq(): Enumerable;
without(value: any): Enumerable;
'[]': any[];
firstObject: any;
hasEnumerableObservers: boolean;
lastObject: any;
}
/**
A subclass of the JavaScript Error object for use in Ember.
**/
// Restore this to 'typeof Error' when https://github.com/Microsoft/TypeScript/issues/983 is resolved
// ReSharper disable once DuplicatingLocalDeclaration
var Error: any; // typeof Error;
/**
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 Object {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
Iterate over each computed property for the class, passing its name and any
associated metadata (see metaForProperty) to the callback.
**/
static eachComputedProperty(callback: Function, binding: {}): void;
/**
Returns the original hash that was passed to meta().
@param key property name
**/
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
events: {};
}
/**
This mixin allows for Ember objects to subscribe to and emit events.
You can also chain multiple event subscriptions.
**/
class Evented {
has(name: string): boolean;
off(name: string, target: any, method: Function): Evented;
on(name: string, target: any, method: Function): Evented;
one(name: string, target: any, method: Function): Evented;
trigger(name: string, ...args: string[]): void;
}
var FROZEN_ERROR: string;
class Freezable {
freeze(): Freezable;
isFrozen: boolean;
}
var GUID_KEY: string;
namespace Handlebars {
function compile(string: string): Function;
function precompile(string: string, options: any): void;
class Compiler { }
class JavaScriptCompiler { }
function registerPartial(name: string, str: any): void;
function K(): any;
function createFrame(objec: any): any;
function Exception(message: string): void;
class SafeString {
constructor(str: string);
static toString(): string;
}
function parse(string: string): any;
function print(ast: any): void;
var logger: typeof Ember.Logger;
function log(level: string, str: string): void;
function compile(environment: any, options?: any, context?: any, asObject?: any): any;
}
class HashLocation extends Object {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
Iterate over each computed property for the class, passing its name and any
associated metadata (see metaForProperty) to the callback.
**/
static eachComputedProperty(callback: Function, binding: {}): void;
/**
Returns the original hash that was passed to meta().
@param key property name
**/
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
}
class HistoryLocation extends Object {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
Iterate over each computed property for the class, passing its name and any
associated metadata (see metaForProperty) to the callback.
**/
static eachComputedProperty(callback: Function, binding: {}): void;
/**
Returns the original hash that was passed to meta().
@param key property name
**/
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
rootURL: string;
}
var IS_BINDING: RegExp;
class Instrumentation {
getProperties(obj: any, list: any[]): {};
getProperties(obj: any, ...args: string[]): {};
instrument(name: string, payload: any, callback: Function, binding: any): void;
reset(): void;
subscribe(pattern: string, object: any): void;
unsubscribe(subscriber: any): void;
}
var K: Function;
var L