UNPKG

2.31 kBSource Map (JSON)View Raw
1{"version":3,"file":"lifecycle_annotations.js","sourceRoot":"","sources":["../../../../../modules/@angular/router-deprecated/src/lifecycle/lifecycle_annotations.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,6BAA4B,oBAAoB,CAAC,CAAA;AAGjD,2CAAmD,8BAA8B,CAAC,CAAA;AAElF,2CAAuG,8BAA8B,CAAC;AAA9H,+EAAmB;AAAE,qEAAc;AAAE,yEAAgB;AAAE,6EAAkB;AAAE,mEAAmD;AAGtI;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACQ,mBAAW,GAEG,4BAAa,CAAC,wCAAqB,CAAC,CAAC","sourcesContent":["/**\n * This indirection is needed to free up Component, etc symbols in the public API\n * to be used by the decorator versions of these annotations.\n */\n\nimport {makeDecorator} from '../../core_private';\nimport {ComponentInstruction} from '../instruction';\n\nimport {CanActivate as CanActivateAnnotation} from './lifecycle_annotations_impl';\n\nexport {routerCanDeactivate, routerCanReuse, routerOnActivate, routerOnDeactivate, routerOnReuse} from './lifecycle_annotations_impl';\n\n\n/**\n * Defines route lifecycle hook `CanActivate`, which is called by the router to determine\n * if a component can be instantiated as part of a navigation.\n *\n * <aside class=\"is-right\">\n * Note that unlike other lifecycle hooks, this one uses an annotation rather than an interface.\n * This is because the `CanActivate` function is called before the component is instantiated.\n * </aside>\n *\n * The `CanActivate` hook is called with two {@link ComponentInstruction}s as parameters, the first\n * representing the current route being navigated to, and the second parameter representing the\n * previous route or `null`.\n *\n * ```typescript\n * @CanActivate((next, prev) => boolean | Promise<boolean>)\n * ```\n *\n * If `CanActivate` returns or resolves to `false`, the navigation is cancelled.\n * If `CanActivate` throws or rejects, the navigation is also cancelled.\n * If `CanActivate` returns or resolves to `true`, navigation continues, the component is\n * instantiated, and the {@link OnActivate} hook of that component is called if implemented.\n *\n * ### Example\n *\n * {@example router/ts/can_activate/can_activate_example.ts region='canActivate' }\n */\nexport var CanActivate:\n (hook: (next: ComponentInstruction, prev: ComponentInstruction) => Promise<boolean>| boolean) =>\n ClassDecorator = makeDecorator(CanActivateAnnotation);\n"]}
\No newline at end of file