UNPKG

angular2

Version:

Angular 2 - a web framework for modern web apps

1 lines 4.23 kB
{"version":3,"sources":["annotations.js"],"names":[],"mappings":"AAAA,KAAO,EAAC,KAAI,CAAC,KAAO,2BAAyB,CAAC;AAa9C,KAAO,MAAM,OAAK;AAEhB,AACA,YAAU,CAAE,KAAI,CAAG;AACjB,OAAG,MAAM,EAAI,MAAI,CAAC;EACpB;AAAA,AACF;AAAA,AAnBA,KAAK,eAAe,AAAC,uBACb,EAAC,GAAE,CAAG,UAAS,AAAD,CAAG;AAAC,cAcvB,MAAI,AAAC,EAAC,EAdwC;EAAC,CAAC,CAAC,CAAC;AAiCrD,KAAO,MAAM,cAAY;AAEvB,AACA,YAAU,CAAE,KAAI,CAAG;AACjB,OAAG,MAAM,EAAI,MAAI,CAAC;EACpB;AAAA,AACF;AAAA,AAxCA,KAAK,eAAe,AAAC,8BACb,EAAC,GAAE,CAAG,UAAS,AAAD,CAAG;AAAC,cAmCvB,MAAI,AAAC,EAAC,EAnCwC;EAAC,CAAC,CAAC,CAAC;AAsDrD,KAAO,MAAM,WAAS;AAEpB,AACA,YAAU,CAAE,KAAI,CAAG;AACjB,OAAG,MAAM,EAAI,MAAI,CAAC;EACpB;AAAA,AACF;AAAA,AA7DA,KAAK,eAAe,AAAC,2BACb,EAAC,GAAE,CAAG,UAAS,AAAD,CAAG;AAAC,cAwDvB,MAAI,AAAC,EAAC,EAxDwC;EAAC,CAAC,CAAC,CAAC;AA4ErD,KAAO,MAAM,SAAO;AAClB,AACA,YAAU,CAAE,AAAD,CAAG,GACd;AAAA,AACF;AAAA,AAjFA,KAAK,eAAe,AAAC,yBACb,EAAC,GAAE,CAAG,UAAS,AAAD,CAAG;AAAC,cA6EvB,MAAI,AAAC,EAAC,EA7EwC;EAAC,CAAC,CAAC,CAAC;AA6GrD,KAAO,MAAM,qBAAmB;AAC9B,AACA,YAAU,CAAE,AAAD,CAAG,GACd;AAAA,AAEA,IAAI,MAAI,EAAI;AACV,SAAO,KAAG,CAAC;EACb;AAAA,AACF;AAAA,AAtHA,KAAK,eAAe,AAAC,qCACb,EAAC,GAAE,CAAG,UAAS,AAAD,CAAG;AAAC,cA8GvB,MAAI,AAAC,EAAC,EA9GwC;EAAC,CAAC,CAAC,CAAC;AAqIrD,KAAO,MAAM,WAAS;AACpB,AACA,YAAU,CAAE,AAAD,CAAG,GACd;AAAA,AACF;AAAA,AA1IA,KAAK,eAAe,AAAC,2BACb,EAAC,GAAE,CAAG,UAAS,AAAD,CAAG;AAAC,cAsIvB,MAAI,AAAC,EAAC,EAtIwC;EAAC,CAAC,CAAC,CAAC;AA0IrD","file":"angular2/src/di/annotations.es6","sourcesContent":["import {CONST} from \"angular2/src/facade/lang\";\n\n/**\n * A parameter annotation that specifies a dependency.\n *\n * ```\n * class AComponent {\n * constructor(@Inject(MyService) aService:MyService) {}\n * }\n * ```\n *\n * @exportedAs angular2/di_annotations\n */\nexport class Inject {\n token;\n @CONST()\n constructor(token) {\n this.token = token;\n }\n}\n\n/**\n * A parameter annotation that specifies a `Promise` of a dependency.\n *\n * ```\n * class AComponent {\n * constructor(@InjectPromise(MyService) aServicePromise:Promise<MyService>) {\n * aServicePromise.then(aService:MyService => ...);\n * }\n * }\n * ```\n *\n * @exportedAs angular2/di_annotations\n */\nexport class InjectPromise {\n token;\n @CONST()\n constructor(token) {\n this.token = token;\n }\n}\n\n/**\n * A parameter annotation that creates a synchronous lazy dependency.\n *\n * ```\n * class AComponent {\n * constructor(@InjectLazy(MyService) aServiceFn:Function) {\n * var aService:MyService = aServiceFn();\n * }\n * }\n * ```\n *\n * @exportedAs angular2/di_annotations\n */\nexport class InjectLazy {\n token;\n @CONST()\n constructor(token) {\n this.token = token;\n }\n}\n\n/**\n * A parameter annotation that marks a dependency as optional. {@link Injector} provides `null` if the dependency is not\n * found.\n *\n * ```\n * class AComponent {\n * constructor(@Optional() aService:MyService) {\n * this.aService = aService;\n * }\n * }\n * ```\n *\n * @exportedAs angular2/di_annotations\n */\nexport class Optional {\n @CONST()\n constructor() {\n }\n}\n\n/**\n * `DependencyAnnotation` is used by the framework to extend DI.\n *\n * Only annotations implementing `DependencyAnnotation` are added to the list of dependency properties.\n *\n * For example:\n *\n * ```\n * class Parent extends DependencyAnnotation {}\n * class NotDependencyProperty {}\n *\n * class AComponent {\n * constructor(@Parent @NotDependencyProperty aService:AService) {}\n * }\n * ```\n *\n * will create the following dependency:\n *\n * ```\n * new Dependency(Key.get(AService), [new Parent()])\n * ```\n *\n * The framework can use `new Parent()` to handle the `aService` dependency\n * in a specific way.\n *\n * @exportedAs angular2/di_annotations\n */\nexport class DependencyAnnotation {\n @CONST()\n constructor() {\n }\n\n get token() {\n return null;\n }\n}\n\n/**\n * A marker annotation that marks a class as available to `Injector` for creation. Used by tooling for\n * generating constructor stubs.\n *\n * ```\n * class NeedsService {\n * constructor(svc:UsefulService) {}\n * }\n *\n * @Injectable\n * class UsefulService {}\n * ```\n * @exportedAs angular2/di_annotations\n */\nexport class Injectable {\n @CONST()\n constructor() {\n }\n}\n"]}