Files
Angular-Docs-Cn/modules/@angular/router/src/lifecycle_reflector.ts
T

9 lines
267 B
TypeScript
Raw Normal View History

2016-05-02 10:36:58 -07:00
import {Type, isBlank} from './facade/lang';
2016-04-22 12:05:38 -07:00
export function hasLifecycleHook(name: string, obj: Object): boolean {
2016-04-29 18:05:06 -07:00
if (isBlank(obj)) return false;
2016-04-22 12:05:38 -07:00
let type = obj.constructor;
if (!(type instanceof Type)) return false;
return name in(<any>type).prototype;
}