Skip to content

Commit

Permalink
fix: add useExisting for custom provider
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Sep 20, 2020
1 parent 92a0dcc commit ea84c42
Show file tree
Hide file tree
Showing 30 changed files with 808 additions and 365 deletions.
61 changes: 53 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,67 @@ A Provider is a abstract concept. Maybe an Entity, a File, a structure, a compon
### Usage
```javascript

import { boot, Application } from '@augejs/module-core';
import { Module, Config, Value, boot, ILogger, GetLogger } from '@augejs/module-core';

@Module()
@Config({
fullName: "augejs awesome~",
hello: {
name: 'augejs',
age: 12,
}
})
class Module1 {
@Value('hello')
testName!:string;

@Value('fullName')
fullName!:string;

@Value('hello.age')
age!:number;

@GetLogger()
logger!:ILogger;

@Application()
export class AppModule {
onInit() {
console.log('AppModule onInit ');
async onInit() {
this.logger.info('Module1 onInit');
this.logger.info(`config: hello: ${JSON.stringify(this.testName)}`);
this.logger.info(`config fullName: ${this.fullName}`);
this.logger.info(`config age: ${this.age}`);
}
onAppDidReady(context:any) {
console.log('AppModule onAppDidReady ');
}

@Module()
class Module2 {
@GetLogger()
logger!:ILogger;

async onInit() {
this.logger.info('Module2 onInit');
}
}

@Module({
subModules: [
Module1, [Module2]
]
})
class AppModule {

@GetLogger()
logger!:ILogger;

async onInit() {
this.logger.info('AppModule onInit');
}
}

(async () => {
await boot(AppModule);
await boot(AppModule);
})();


```


Expand Down
Loading

0 comments on commit ea84c42

Please sign in to comment.