@uxland/ioc
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

UXL IOC npm version

Build Status Statements Branches Functions Lines
BuildStatus Statements Branches Functions Lines

Installation

npm i @uxland/ioc

Usage

Register constructor singleton to iocContainer

Registers a constructor singleton to the InversionOfControl container. Each time a reference of the constructor or abstract class is provided with inversify, the container will provide with its singleton pair.

@provideSingleton()
class IOCAdapter {
  method(): void {
    console.log("Calling `method` from `IOCAdapter`");
  }
}

class Adapter {
  constructor(@inject(IOCAdapter) protected adapter: IOCAdapter) {
    this.adapter.method(); // => 'Calling `method` from `IOCAdapter`'
  }
}

Set Mediator resolver

This method overrides the mediator default resolver to use our own container.

const container: Container = new Container();
setMediatorResolver(container);

Readme

Keywords

none

Package Sidebar

Install

npm i @uxland/ioc

Weekly Downloads

19

Version

1.0.4

License

BSD-4-Clause

Unpacked Size

81.3 kB

Total Files

11

Last publish

Collaborators

  • avizcaino
  • uxland-admin