docs(di/src/annotations): use triple backticks to code-fence code blocks
This commit is contained in:
parent
11c52ce06d
commit
983c00c495
@ -3,9 +3,11 @@ import {CONST} from "facade/lang";
|
|||||||
/**
|
/**
|
||||||
* A parameter annotation that creates a synchronous eager dependency.
|
* A parameter annotation that creates a synchronous eager dependency.
|
||||||
*
|
*
|
||||||
* class AComponent {
|
* ```
|
||||||
* constructor(@Inject('aServiceToken') aService) {}
|
* class AComponent {
|
||||||
* }
|
* constructor(@Inject('aServiceToken') aService) {}
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export class Inject {
|
export class Inject {
|
||||||
@ -19,11 +21,13 @@ export class Inject {
|
|||||||
/**
|
/**
|
||||||
* A parameter annotation that creates an asynchronous eager dependency.
|
* A parameter annotation that creates an asynchronous eager dependency.
|
||||||
*
|
*
|
||||||
* class AComponent {
|
* ```
|
||||||
* constructor(@InjectPromise('aServiceToken') aServicePromise) {
|
* class AComponent {
|
||||||
* aServicePromise.then(aService => ...);
|
* constructor(@InjectPromise('aServiceToken') aServicePromise) {
|
||||||
* }
|
* aServicePromise.then(aService => ...);
|
||||||
* }
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export class InjectPromise {
|
export class InjectPromise {
|
||||||
@ -37,11 +41,13 @@ export class InjectPromise {
|
|||||||
/**
|
/**
|
||||||
* A parameter annotation that creates a synchronous lazy dependency.
|
* A parameter annotation that creates a synchronous lazy dependency.
|
||||||
*
|
*
|
||||||
* class AComponent {
|
* ```
|
||||||
* constructor(@InjectLazy('aServiceToken') aServiceFn) {
|
* class AComponent {
|
||||||
* aService = aServiceFn();
|
* constructor(@InjectLazy('aServiceToken') aServiceFn) {
|
||||||
* }
|
* aService = aServiceFn();
|
||||||
* }
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export class InjectLazy {
|
export class InjectLazy {
|
||||||
@ -60,16 +66,20 @@ export class InjectLazy {
|
|||||||
*
|
*
|
||||||
* For example:
|
* For example:
|
||||||
*
|
*
|
||||||
* class Parent extends DependencyAnnotation {}
|
* ```
|
||||||
* class NotDependencyProperty {}
|
* class Parent extends DependencyAnnotation {}
|
||||||
|
* class NotDependencyProperty {}
|
||||||
*
|
*
|
||||||
* class AComponent {
|
* class AComponent {
|
||||||
* constructor(@Parent @NotDependencyProperty aService:AService) {}
|
* constructor(@Parent @NotDependencyProperty aService:AService) {}
|
||||||
* }
|
* }
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
* will create the following dependency:
|
* will create the following dependency:
|
||||||
*
|
*
|
||||||
* new Dependency(Key.get(AService), [new Parent()])
|
* ```
|
||||||
|
* new Dependency(Key.get(AService), [new Parent()])
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
* The framework can use `new Parent()` to handle the `aService` dependency
|
* The framework can use `new Parent()` to handle the `aService` dependency
|
||||||
* in a specific way.
|
* in a specific way.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user