Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tractor/dependency-injection

Package Overview
Dependencies
Maintainers
7
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tractor/dependency-injection

DI container for tractor

  • 1.9.4-tractor-to-playwright.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
7
Weekly downloads
 
Created
Source

@tractor/dependency-injection

Dependency Injection container for tractor.

npm version

API

constant

Adds a constant reference to the container by name.

Usage
import { DI } from '@tractor/dependency-injection';

DI.constant({ config: { my: 'config' }});

factory

Adds a factory function to the container by name.

Usage
import { DI } from '@tractor/dependency-injection';

DI.factory(function myFunction () {});

call

calls a function with injected dependencies.

Usage
import { DI } from '@tractor/dependency-injection';

let config = {};
DI.constant({ config });

function init (config) {}
init['@Inject'] = ['config'];

DI.call(init);

instantiate

Creates a new instance of a factory with injected dependencies.

Usage
import { DI } from '@tractor/dependency-injection';

let config = {};
DI.constant({ config });

function Engine () {}
DI.factory(Engine);

function Tractor (config, engine) {
    this.config = config;
    this.engine = engine;
}
Tractor['@Inject'] = ['config', 'Engine'];
DI.factory(Tractor);

let tractor = DI.instantiate(Tractor);

FAQs

Package last updated on 10 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc