dera
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Dera

Yet another TypeDI extension for NodeCG

This TypeDI extension enable the usage of NodeCG ecosystem in services via decorators.

Install

$ npm install dera

Usage

import { useContainer, InjectNodeCG, InjectReplicant } from "dera";
import { NodeCG, ReplicantServer } from "nodecg/types/server";
import { Container, Service } from "typedi";

@Service()
class HelloModule {
  @InjectNodeCG() nodecg!: NodeCG;
  @InjectReplicant({ defaultValue: "Spark" }) name!: ReplicantServer<string>;

  say(): void {
    console.log(`Hello ${this.name.value}!`); // Prints "Hello Spark!"
  }
}

export = (nodecg: NodeCG) => {
  useContainer(Container, nodecg);

  Container.get(HelloModule).say();
};

API

See the TypeScript definition file.

Author

Alexandre Breteau - @0xSeldszar

License

MIT © Alexandre Breteau

Readme

Keywords

Package Sidebar

Install

npm i dera

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

6.46 kB

Total Files

5

Last publish

Collaborators

  • seldszar