Created
July 23, 2016 13:04
-
-
Save atsu85/5d6e5d6dbde996aaa33c1538a3eed9cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** This file contains interfaces for lifecycle hooks that all HTML Behaviors (such as Views and Custom Elements) can use. */ | |
declare module 'aurelia/lifecycle/html-behavior-hooks' { | |
import {View} from "aurelia-framework"; | |
/** the first Html Behavior hook, that is called after the constructor */ | |
export interface Created { | |
/** | |
* If the view-model implements the created callback it is invoked next. | |
* If your behavior is a custom element, it's view has also been created and both the view-model and the view are connected to their controller. | |
* The created callback will receive the instance of the "owningView". | |
* This is the view that the component is declared inside of. | |
* If the component itself has a view, this will be passed second. | |
*/ | |
created(owningView: View, myView: View): void; | |
} | |
export interface Bind { | |
/** | |
* Databinding is then activated on the view and view-model. | |
* If the view-model has a bind callback, it will be invoked at this time. | |
* The "binding context" to which the component is being bound will be passed first. | |
* An "override context" will be passed second. | |
* The override context contains information used to traverse the parent hierarchy | |
* and can also be used to add any contextual properties that the component wants to add. | |
* It should be noted that when the view-model has implemented the bind callback, | |
* the databinding framework will not invoke the changed handlers for the view-model's bindable properties until the "next" time those properties are updated. | |
* If you need to perform specific post-processing on your bindable properties, | |
* when implementing the bind callback, you should do so manually within the callback itself. | |
*/ | |
bind(bindingContext: Object, overrideContext: Object): void; | |
} | |
/** called when component html is attached to the DOM */ | |
export interface Attached { | |
/** | |
* Next, the component is attached to the DOM (in document). | |
* If the view-model has an attached callback, it will be invoked at this time. | |
*/ | |
attached(): void; | |
} | |
export interface Detached { | |
/** | |
* At some point in the future, the component may be removed from the DOM. | |
* If/When this happens, and if the view-model has a detached callback, this is when it will be invoked. | |
*/ | |
detached(): void; | |
} | |
export interface Unbind { | |
/** | |
* After a component is detached, it's usually unbound. | |
* If your view-model has the unbind callback, it will be invoked during this process. | |
*/ | |
unbind(): void; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment