ember-disable-proxy-controllers
Version:
Disables ObjectController/ArrayController for autogenerated controllers.
1,005 lines (1,003 loc) • 258 kB
TypeScript
interface DOMElement {}
interface Promise<T> {}
declare class Registry {}
declare class Transition {}
declare namespace Handlebars { class SafeString {} }
declare class JQuery {}
declare module 'ember' {
export namespace Ember {
/**
* Define an assertion that will throw an exception if the condition is not met. Ember build tools will remove any calls to `Ember.assert()` when doing a production build. Example:
*/
function assert(desc: string, test: boolean);
/**
* Display a warning with the provided message. Ember build tools will remove any calls to `Ember.warn()` when doing a production build.
*/
function warn(message: string, test: boolean);
/**
* Display a debug notice. Ember build tools will remove any calls to `Ember.debug()` when doing a production build.
*/
function debug(message: string);
/**
* Display a deprecation warning with the provided message and a stack trace (Chrome and Firefox only). Ember build tools will remove any calls to `Ember.deprecate()` when doing a production build.
*/
function deprecate(message: string, test: boolean, options: {});
/**
* Alias an old, deprecated method with its new counterpart.
*/
function deprecateFunc(message: string, func: Function): Function;
/**
* Run a function meant for debugging. Ember build tools will remove any calls to `Ember.runInDebug()` when doing a production build.
*/
function runInDebug(func: Function);
/**
* Identical to `Object.create()`. Implements if not available natively.
*/
function create();
/**
* Array polyfills to support ES5 features in older browsers.
*/
var ArrayPolyfills: any;
/**
* Debug parameter you can turn on. This will log all bindings that fire to the console. This should be disabled in production code. Note that you can also enable this from the console or temporarily.
*/
var LOG_BINDINGS: boolean;
/**
* 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;
function oneWay(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): {};
var VERSION: string;
/**
* Standard environmental variables. You can define these in a global `EmberENV` variable before loading Ember to control various configuration settings.
*/
var ENV: {};
/**
* Determines whether Ember should enhance some built-in object prototypes to provide a more friendly API. If enabled, a few methods will be added to `Function`, `String`, and `Array`. `Object.prototype` will not be enhanced, which is the one that causes most trouble for people.
*/
var EXTEND_PROTOTYPES: boolean;
/**
* Determines whether Ember logs a full stack trace during deprecation warnings
*/
var LOG_STACKTRACE_ON_DEPRECATION: boolean;
/**
* Determines whether Ember should add ECMAScript 5 Array shims to older browsers.
*/
var SHIM_ES5: boolean;
/**
* Determines whether Ember logs info about version of used libraries
*/
var LOG_VERSION: boolean;
/**
* Add an event listener
*/
function addListener(obj: any, eventName: string, target: {}|Function, method: Function|string, once: boolean);
/**
* Remove an event listener
*/
function removeListener(obj: any, eventName: string, target: {}|Function, method: Function|string);
/**
* 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: Ember.Array, actions: Ember.Array): 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;
/**
* Returns all of the keys defined on an object or hash. This is useful when inspecting objects for debugging. On browsers that support it, this uses the native `Object.keys` implementation.
*/
function keys(obj: {}): Ember.Array;
/**
* Merge the contents of two objects together into the first object.
*/
function merge(original: {}, updates: {}): {};
function mixin(obj: any, mixins: any): void;
/**
* Denotes a required property for a mixin
*/
function required();
/**
* Makes a method available via an additional name.
*/
function aliasMethod(methodName: string): Descriptor;
/**
* Specify a method that observes property changes.
*/
function observer(propertyNames: string, func: Function): void;
/**
* Specify a method that observes property changes.
*/
function immediateObserver(propertyNames: string, func: Function): void;
/**
* When observers fire, they are called with the arguments `obj`, `keyName`.
*/
function beforeObserver(propertyNames: string, func: Function): void;
function addObserver(obj: any, path: string, targetOrMethod: {}|Function, method: Function|string);
function removeObserver(obj: any, path: string, target: {}|Function, method: Function|string);
function addBeforeObserver(obj: any, path: string, target: {}|Function, method: Function|string);
function removeBeforeObserver(obj: any, path: string, target: {}|Function, method: Function|string);
/**
* This function is called just before an object property is about to change. It will notify any before observers and prepare caches among other things.
*/
function propertyWillChange(obj: {}, keyName: string): void;
/**
* This function is called just after an object property has changed. It will notify any observers and clear caches among other things.
*/
function propertyDidChange(obj: {}, keyName: string): void;
/**
* Make a series of property changes together in an exception-safe way.
*/
function changeProperties(callback: Function, binding: 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): {};
/**
* 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(obj: {}, path: string, value: {});
/**
* 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;
/**
* Returns true if the passed object is an array or Array-like.
*/
function isArray(obj: {}): boolean;
/**
* Forces the passed object to be part of an array. If the object is already an array or array-like, it will return the object. Otherwise, it will add the object to an array. If obj is `null` or `undefined`, it will return an empty array.
*/
function makeArray(obj: {}): Ember.Array;
/**
* Checks to see if the `methodName` exists on the `obj`.
*/
function canInvoke(obj: {}, methodName: string): boolean;
/**
* 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: Ember.Array): any;
/**
* Provides try/finally functionality, while working around Safari's double finally bug.
*/
function tryFinally(tryable: Function, finalizer: Function, binding: {}): any;
/**
* Provides try/catch/finally functionality, while working around Safari's double finally bug.
*/
function tryCatchFinally(tryable: Function, catchable: Function, finalizer: Function, binding: {}): any;
/**
* Returns a consistent type for the passed item.
*/
function typeOf(item: {}): string;
/**
* Convenience method to inspect an object. This method will attempt to convert the object into a useful string description.
*/
function inspect(obj: {}): string;
/**
* Tears down the meta on an object so that it can be garbage collected. Multiple calls will have no effect.
*/
function destroy(obj: {}): void;
/**
* Creates a computed property which operates on dependent arrays and is updated with "one at a time" semantics. When items are added or removed from the dependent array(s) an array computed only operates on the change instead of re-evaluating the entire array. This should return an array, if you'd like to use "one at a time" semantics and compute some value other then an array look at `Ember.reduceComputed`.
*/
function arrayComputed(...dependentKeys: string[]): ComputedProperty;
function arrayComputed(options: {}): ComputedProperty;
/**
* Creates a computed property which operates on dependent arrays and is updated with "one at a time" semantics. When items are added or removed from the dependent array(s) a reduce computed only operates on the change instead of re-evaluating the entire array.
*/
function reduceComputed(...dependentKeys: string[]): ComputedProperty;
function reduceComputed(options: {}): ComputedProperty;
/**
* Detects when a specific package of Ember (e.g. 'Ember.Handlebars') has fully loaded and is available for extension.
*/
function onLoad(name: string, callback: Function);
/**
* Called when an Ember.js package (e.g Ember.Handlebars) has finished loading. Triggers any callbacks registered for this event.
*/
function runLoadHooks(name: string, object: {});
/**
* 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 guarantee that `Ember.EXTEND_PROTOTYPES` will be `true`.
*/
function A(): NativeArray;
/**
* Defines the hash of localized strings for the current language. Used by the `Ember.String.loc()` helper. To localize, add string values to this hash.
*/
var STRINGS: {};
/**
* This will compare two javascript values of possibly different types. It will tell you which one is greater than the other by returning:
*/
function compare(v: {}, w: {}): number;
/**
* Creates a clone of the passed object. This function can take just about any type of object and create a clone of it, including primitive values (which are not actually cloned because they are immutable).
*/
function copy(obj: {}, deep: boolean): {};
/**
* Compares two objects, returning true if they are logically equal. This is a deeper comparison than a simple triple equal. For sets it will compare the internal objects. For any other object that implements `isEqual()` it will respect that method.
*/
function isEqual(a: {}, b: {}): boolean;
/**
* Global hash of shared templates. This will automatically be populated by the build tools so that you can store your Handlebars templates in separate files that get loaded into JavaScript at buildtime.
*/
var TEMPLATES: {};
/**
* Alias for jQuery
*/
function $();
export namespace Handlebars {
/**
* DEPRECATED:
* Lookup both on root and on window. If the path starts with a keyword, the corresponding object will be looked up in the template's data hash and used to resolve the path.
*/
function get(root: {}, path: string, options: {});
/**
* DEPRECATED:
* A helper function used by `registerBoundHelper`. Takes the provided Handlebars helper function fn and returns it in wrapped bound helper form.
*/
function makeBoundHelper(function: Function, dependentKeys: string);
/**
* Register a bound handlebars helper. Bound helpers behave similarly to regular handlebars helpers, with the added ability to re-render when the underlying data changes.
*/
function registerBoundHelper(name: string, function: Function, dependentKeys: string);
export class helpers {
/**
* `bind-attr` allows you to create a binding between DOM element attributes and Ember objects. For example:
*/
'bind-attr'(options: {}): string;
/**
* DEPRECATED:
* See `bind-attr`
*/
bindAttr(context: Function, options: {}): string;
/**
* DEPRECATED: Use `{{each}}` helper instead.
* `{{collection}}` is a `Ember.Handlebars` helper for adding instances of `Ember.CollectionView` to a template. See [Ember.CollectionView](/api/classes/Ember.CollectionView.html) for additional information on how a `CollectionView` functions.
*/
collection();
/**
* The `{{component}}` helper lets you add instances of `Ember.Component` to a template. See [Ember.Component](/api/classes/Ember.Component.html) for additional information on how a `Component` functions.
*/
component();
/**
* Execute the `debugger` statement in the current template's context.
*/
debugger(property: string);
/**
* The `{{#each}}` helper loops over elements in a collection. It is an extension of the base Handlebars `{{#each}}` helper.
*/
each(name: string, path: string, options: {});
if();
unless();
/**
* The `{{input}}` helper inserts an HTML `<input>` tag into the template, with a `type` value of either `text` or `checkbox`. If no `type` is provided, `text` will be the default value applied. The attributes of `{{input}}` match those of the native HTML tag as closely as possible for these two types. ## Use as text field An `{{input}}` with no `type` or a `type` of `text` will render an HTML text input. The following HTML attributes can be set via the helper:
*/
input(options: {});
/**
* Calls [Ember.String.loc](/api/classes/Ember.String.html#method_loc) with the provided string.
*/
loc(str: string);
/**
* `log` allows you to output the value of variables in the current rendering context. `log` also accepts primitive types such as strings or numbers.
*/
log(property: string);
/**
* The `partial` helper renders another template without changing the template context:
*/
partial(partialName: string);
/**
* DEPRECATED:
*/
template(templateName: string);
/**
* `{{textarea}}` inserts a new instance of `<textarea>` tag into the template. The attributes of `{{textarea}}` match those of the native HTML tags as closely as possible.
*/
textarea(options: {});
/**
* `unbound` allows you to output a property without binding. *Important:* The output will not be updated if the property changes. Use with caution.
*/
unbound(property: string): string;
/**
* `{{view}}` inserts a new instance of an `Ember.View` into a template passing its options to the `Ember.View`'s `create` method and using the supplied block as the view's own template.
*/
view();
/**
* Use the `{{with}}` helper when you want to aliases the to a new name. It's helpful for semantic clarity and to retain default scope or to reference from another `{{with}}` block.
*/
with(context: Function, options: {}): string;
/**
* `{{yield}}` denotes an area of a template that will be rendered inside of another template. It has two main uses:
*/
yield(options: {}): string;
/**
* The `{{action}}` helper provides a useful shortcut for registering an HTML element within a template for a single DOM event and forwarding that interaction to the template's controller or specified `target` option.
*/
action(actionName: string, context: {}, options: {});
/**
* The `{{link-to}}` helper renders a link to the supplied `routeName` passing an optionally supplied model to the route as its `model` context of the route. The block for `{{link-to}}` becomes the innerHTML of the rendered element:
*/
'link-to'(routeName: string, context: {}, options: {}): string;
/**
* DEPRECATED:
* See [link-to](/api/classes/Ember.Handlebars.helpers.html#method_link-to)
*/
linkTo(routeName: string, context: {}): string;
/**
* The `outlet` helper is a placeholder that the router will fill in with the appropriate template based on the current state of the application.
*/
outlet(property: string): string;
/**
* This is a sub-expression to be used in conjunction with the link-to helper. It will supply url query parameters to the target route.
*/
'query-params'(hash: {}): string;
/**
* Calling ``{{render}}`` from within a template will insert another template that matches the provided name. The inserted template will access its properties on its own controller (rather than the controller of the parent template).
*/
render(name: string, context: {}, options: {}): string;
}
}
export namespace HTMLBars {
export class Helper {
}
}
export namespace Test {
/**
* 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<any>;
/**
* Clicks an element and triggers any actions triggered by the element's `click` event.
*/
function click(selector: string): RSVP.Promise<any>;
/**
* Unchecks a checkbox. Ensures the absence of the `checked` attribute
*/
function check(selector: string): RSVP.Promise<any>;
/**
* Simulates a key event, e.g. `keypress`, `keydown`, `keyup` with the desired keyCode
*/
function keyEvent(selector: string, type: string, keyCode: number): RSVP.Promise<any>;
/**
* Fills in an input element with some text.
*/
function fillIn(selector: string, text: string): RSVP.Promise<any>;
/**
* Finds an element in the context of the app's container element. A simple alias for `app.$(selector)`.
*/
function find(selector: string): {};
/**
* Like `find`, but throws an error if the element selector returns no results.
*/
function findWithAssert(selector: string): {};
/**
* 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>;
/**
* Returns the currently active route name.
*/
function currentRouteName(): {};
/**
* Returns the current path.
*/
function currentPath(): {};
/**
* Returns the current URL.
*/
function currentURL(): {};
/**
* 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.
*/
function pauseTest(): {};
/**
* Triggers the given DOM event on the element identified by the provided selector.
*/
function triggerEvent(selector: string, context: string, type: string, options: {}): RSVP.Promise<any>;
/**
* 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).
*/
function setupForTesting();
/**
* `registerHelper` is used to register a test helper that will be injected when `App.injectTestHelpers` is called.
*/
function registerHelper(name: string, helperMethod: Function, options: {});
/**
* `registerAsyncHelper` is used to register an async test helper that will be injected when `App.injectTestHelpers` is called.
*/
function registerAsyncHelper(name: string, helperMethod: Function);
/**
* Remove a previously added helper method.
*/
function unregisterHelper(name: string);
/**
* Used to register callbacks to be fired whenever `App.injectTestHelpers` is called.
*/
function onInjectHelpers(callback: Function);
/**
* 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);
/**
* Used to allow ember-testing to communicate with a specific testing framework.
*/
var adapter: any;
/**
* Replacement for `Ember.RSVP.resolve` The only difference is this uses an instance of `Ember.Test.Promise`
*/
function resolve(The: 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.
*/
function registerWaiter(context: {}, callback: Function);
/**
* `unregisterWaiter` is used to unregister a callback that was registered with `registerWaiter`.
*/
function unregisterWaiter(context: {}, callback: Function);
/**
* 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.
*/
var 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.
*/
var testing: boolean;
/**
* This will be used as the container to inject the test helpers into. By default the helpers are injected into `window`.
*/
var helperContainer: {};
/**
* 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();
/**
* This removes all helpers that have been registered, and resets and functions that were overridden by the helpers.
*/
function removeTestHelpers();
/**
* The primary purpose of this class is to create hooks that can be implemented by an adapter for various test frameworks.
*/
export class Adapter {
/**
* This callback will be called whenever an async operation is about to start.
*/
asyncStart();
/**
* This callback will be called whenever an async operation has completed.
*/
asyncEnd();
/**
* 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);
}
/**
* This class implements the methods defined by Ember.Test.Adapter for the QUnit testing framework.
*/
export class QUnitAdapter extends Adapter {
}
}
/**
* `Ember.ControllerMixin` provides a standard interface for all classes that compose Ember's controller layer: `Ember.Controller`, `Ember.ArrayController`, and `Ember.ObjectController`.
*/
export class ControllerMixin implements ActionHandler {
/**
* An array of other controller objects available inside instances of this controller via the `controllers` property:
*/
needs: Ember.Array;
/**
* DEPRECATED: Use `needs` instead
*/
controllerFor();
/**
* Stores the instances of other controllers available from within this controller. Any controller listed by name in the `needs` property will be accessible by name through this property.
*/
controllers: {};
/**
* 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`
*/
queryParams: any;
/**
* Transition the application into another route. The route may be either a single route or route path:
*/
transitionToRoute(name: string, ...models: any[]);
transitionToRoute(name: string, options: {});
/**
* DEPRECATED:
*/
transitionTo();
/**
* 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[]);
/**
* DEPRECATED:
*/
replaceWith();
/**
* 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);
}
/**
* 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.
*/
export class Application extends Namespace {
/**
* The application instance's container. The container stores all of the instance-specific state for this application run.
*/
container: Container;
/**
* The registry for this application instance. It should use the `applicationRegistry` as a fallback.
*/
registry: Registry;
/**
* The DOM events for which the event dispatcher should listen.
*/
customEvents: {};
/**
* 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;
/**
* Use this to defer readiness until some condition is true.
*/
deferReadiness();
/**
* 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();
/**
* Registers a factory that can be used for dependency injection (with `App.inject`) or for service lookup. Each factory is registered with a full name including two parts: `type:name`.
*/
register(fullName: string, factory: Function, options: {});
/**
* Define a dependency injection onto a specific factory or all factories of a type.
*/
inject(factoryNameOrType: string, property: string, injectionName: string);
/**
* Reset the application. This is typically used only in tests. It cleans up the application in the following order:
*/
reset();
/**
* Set this to provide an alternate class to `Ember.DefaultResolver`
*/
resolver: any;
/**
* Initializer receives an object which has the following attributes: `name`, `before`, `after`, `initialize`. The only required attribute is `initialize, all others are optional.
*/
initializer(initializer: {});
}
/**
* The DefaultResolver defines the default lookup rules to resolve container lookups before consulting the container for registered items:
*/
export class DefaultResolver extends 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);
/**
* 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);
/**
* Given a parseName object (output from `parseName`), apply the conventions expected by `Ember.Router`
*/
useRouterNaming(parsedName: {});
/**
* Look up the template in Ember.TEMPLATES
*/
resolveTemplate(parsedName: {});
/**
* Lookup the view using `resolveOther`
*/
resolveView(parsedName: {});
/**
* Lookup the controller using `resolveOther`
*/
resolveController(parsedName: {});
/**
* Lookup the route using `resolveOther`
*/
resolveRoute(parsedName: {});
/**
* Lookup the model on the Application namespace
*/
resolveModel(parsedName: {});
/**
* Look up the specified object (from parsedName) on the appropriate namespace (usually on the Application)
*/
resolveHelper(parsedName: {});
/**
* Look up the specified object (from parsedName) on the appropriate namespace (usually on the Application)
*/
resolveOther(parsedName: {});
}
/**
* The `ContainerDebugAdapter` helps the container and resolver interface with tools that debug Ember such as the [Ember Extension](https://github.com/tildeio/ember-extension) for Chrome and Firefox.
*/
export class ContainerDebugAdapter extends Object {
/**
* The container of the application being debugged. This property will be injected on creation.
*/
container: any;
/**
* 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): Ember.Array;
}
/**
* 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.
*/
export class DataAdapter {
/**
* The container of the application being debugged. This property will be injected on creation.
*/
container: any;
/**
* The container-debug-adapter which is used to list all models.
*/
containerDebugAdapter: 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(): Ember.Array;
/**
* 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(recordsAdded: Function, recordsUpdated: Function, recordsRemoved: Function): Function;
}
/**
* Defines string helper methods including string formatting and localization. Unless `Ember.EXTEND_PROTOTYPES.String` is `false` these methods will also be added to the `String.prototype` as well.
*/
export class String {
/**
* Mark a string as safe for unescaped output with Handlebars. If you return HTML from a Handlebars helper, use this function to ensure Handlebars does not escape the HTML.
*/
static htmlSafe(): Handlebars.SafeString;
/**
* 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: Ember.Array): 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: Ember.Array): 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): Ember.Array;
/**
* 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;
}
export class platform {
/**
* Set to true if the platform supports native getters and setters.
*/
hasPropertyAccessors: any;
/**
* Identical to `Object.defineProperty()`. Implements as much functionality as possible if not available natively.
*/
defineProperty(obj: {}, keyName: string, desc: {}): void;
}
/**
* 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.
*/
export class Binding {
/**
* This copies the Binding so it can be connected to another object.
*/
copy(): 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;
/**
* 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;
/**
* Creates a new Binding instance and makes it apply in a single direction. A one-way binding will relay changes on the `from` side object (supplied as the `from` argument) 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(from: string, flag: boolean): Binding;
toString(): string;
/**
* 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;
/**
* Disconnects the binding instance. Changes will no longer be relayed. You will not usually need to call this method.
*/
disconnect(obj: {}): Binding;
}
/**
* A computed property transforms an object's function into a property.
*/
export class ComputedProperty extends Descriptor {
/**
* DEPRECATED: All computed properties are cacheble by default. Use `volatile()` instead to opt-out to caching.
* Properties are cacheable by default. Computed property will automatically cache the return value of your function until one of the dependent keys changes.
*/
cacheable(aFlag: boolean): 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: {});
/**
* Access the value of the function backing the computed property. If this property has already been cached, return the cached result. Otherwise, call the function passing the property name as an argument.
*/
get(keyName: string): {};
/**
* Set the value of a computed property. If the function that backs your computed property does not accept arguments then the default action for setting would be to define the property on the current object, and set the value of the property to the value being set.
*/
set(keyName: string, newValue: {}, oldValue: string): {};
}
/**
* 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()`.
*/
export 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 they values 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;
/**
* DEPRECATED: Use `Ember.computed.or` instead.
* A computed property that returns the first truthy value from a list of dependent properties.
*/
any(dependentKey: string): ComputedProperty;
/**
* A computed property that returns the array of values for the provided dependent properties.
*/
collect(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;
/**
* DEPRECATED: Use `Ember.computed.oneWay` or custom CP with default instead.
* A computed property that acts like a standard getter and setter, but returns the value at the provided `defaultPath` if the property itself has not been set to a value
*/
defaultTo(defaultPath: 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): ComputedProperty;
/**
* A computed property that returns the sum of the value 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;
/**
* DEPRECATED: Use `Ember.computed.mapBy` instead
*/
mapProperty(dependentKey: any, propertyKey: any);
/**
* 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;
/**
* DEPRECATED: Use `Ember.computed.filterBy` instead
*/
filterProperty(dependentKey: any, propertyKey: any, value: any);
/**
* A computed property which returns a new array with all the unique elements from one or more dependent arrays.
*/
uniq(propertyKey: string): ComputedProperty;
/**
* Alias for [Ember.computed.uniq](/api/#method_computed_uniq).
*/
union(propertyKey: string): ComputedProperty;
/**
* A computed property which returns a new array with all the duplicated elements from two or more dependent arrays.
*/
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 which returns a new array with all the properties from the first dependent array sorted based on a property or sort function.
*/
sort(dependentKey: string, sortDefinition: string): ComputedProperty;
}
/**
* Hash of enabled Canary features. Add to this before creating your application.
*/
export class FEATURES {
/**
* Test that a feature is enabled. Parsed by Ember's build tools to leave experimental features out of beta/stable builds.
*/
isEnabled(feature: string): boolean;
}
/**
* Defines some convenience methods for working with Enumerables. `Ember.EnumerableUtils` uses `Ember.ArrayPolyfills` when necessary.
*/
export class EnumerableUtils {
/**
* Calls the map function on the passed object with a specified callback. This uses `Ember.ArrayPolyfill`'s-map method when necessary.
*/
map(obj: {}, callback: Function, thisArg: {}): Ember.Array;
/**
* Calls the forEach function on the passed object with a specified callback. This uses `Ember.ArrayPolyfill`'s-forEach method when necessary.
*/
forEach(obj: {}, callback: Function, thisArg: {});
/**
* Calls the filter function on the passed object with a specified callback. This uses `Ember.ArrayPolyfill`'s-filter method when necessary.
*/
filter(obj: {}, callback: Function, thisArg: {}): Ember.Array;
/**
* Calls the indexOf function on the passed object with a specified callback.