@ealmansi/jagger
TypeScript icon, indicating that this package has built-in type declarations

0.1.37 • Public • Published

@ealmansi/jagger

Setup

  1. Install dependencies:
npm add @ealmansi/jagger
  1. 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!

Readme

Keywords

Package Sidebar

Install

npm i @ealmansi/jagger

Weekly Downloads

2

Version

0.1.37

License

MIT

Unpacked Size

104 kB

Total Files

87

Last publish

Collaborators

  • ealmansi