Skip to content

Commit

Permalink
Merge pull request #20 from readdle/issue-7/lifecycle-hooks
Browse files Browse the repository at this point in the history
Issue 7: added lifecycle hooks typings
  • Loading branch information
Alexandr Rodik authored Oct 26, 2017
2 parents 45236e5 + 55c455c commit 789a9d5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
19 changes: 19 additions & 0 deletions decorators/lifecycle_hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Lifecycle hook that is called when any data-binding property of a directive/component changes.
*/
export interface OnChanges { ngOnChanges(changes: ng.IOnChangesObject): void; }

/**
* Lifecycle hook that is called after data-bindings properties of a directive/component are initialized.
*/
export interface OnInit { ngOnInit(): void; }

/**
* Lifecycle hook that is called when a directive/component is destroyed.
*/
export interface OnDestroy { ngOnDestroy(): void; }

/**
* Lifecycle hook that is called after a component's view has been fully initialized.
*/
export interface AfterViewInit { ngAfterViewInit(): void; }
2 changes: 2 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {NgModuleDecorator} from "./decorators/ng-module/interfaces";

export * from "decorators/lifecycle_hooks";

/**
* NgModule decorator and metadata.
*/
Expand Down
3 changes: 2 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './decorators/ng-module';
export * from "./decorators/ng-module";
export * from "./decorators/lifecycle_hooks";

interface IComponentClass extends Function {
$inject?: Array<string>;
Expand Down

0 comments on commit 789a9d5

Please sign in to comment.