@ealmansi/jagger
v0.1.37
Published
WIP
Downloads
10
Readme
@ealmansi/jagger
Setup
- Install dependencies:
npm add @ealmansi/jagger
- Configure prebuild script:
// package.json
{
"scripts": {
"prebuild": "jagger-generate"
}
}
Usage
import { Jagger } from "@ealmansi/jagger";
export class Logger {
constructor() {}
log(message: string): void {
console.log(message);
}
}
export class App {
constructor(private readonly logger: Logger) {}
start() {
this.logger.log("App started!");
}
}
export class AppModule extends Jagger.Module {
provideLogger = Jagger.instance(Logger);
provideApp = Jagger.instance(App);
}
export abstract class AppComponent extends Jagger.Component {
static module: AppModule;
abstract buildApp(): App;
}
// in index.ts
const app = new AppComponentImpl().provideApp();
app.start(); // App started!