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

9 lines
278 B
TypeScript
Raw Normal View History

import {Type, isBlank} from '@angular/facade/src/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;
}