Files
angular-docs-cn/modules/@angular/router/src/lifecycle_reflector.ts
T
2016-06-09 17:00:15 -07:00

9 lines
268 B
TypeScript

import {Type, isBlank} from './facade/lang';
export function hasLifecycleHook(name: string, obj: Object): boolean {
if (isBlank(obj)) return false;
let type = obj.constructor;
if (!(type instanceof Type)) return false;
return name in (<any>type).prototype;
}