Socket
Socket
Sign inDemoInstall

tsyringe

Package Overview
Dependencies
1
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.1.1

1

dist/decorators.js

@@ -23,2 +23,3 @@ "use strict";

return function (target) {
injectable()(target);
dependency_container_1.instance.registerSingleton(target);

@@ -25,0 +26,0 @@ };

2

package.json
{
"name": "tsyringe",
"version": "2.1.0",
"version": "2.1.1",
"description": "Lightweight dependency injection container for JavaScript/TypeScript",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -13,2 +13,3 @@ [![Travis](https://img.shields.io/travis/Microsoft/tsyringe.svg)](https://travis-ci.org/Microsoft/tsyringe/)

* [injectable()](#injectable)
* [singleton()](@singleton)
* [autoInjectable()](#autoinjectable)

@@ -57,2 +58,23 @@ * [inject()](#inject)

### singleton()
Class decorator factory that registers the class as a singleton within the
global container.
#### Usage
```TypeScript
import {decorators} from "tsyringe";
const {singleton} = decorators;
@singleton()
class Foo {
constructor() {}
}
// some other file
import {container} from "tsyringe";
import {Foo} from "./foo";
const instance = container.resolve(Foo);
```
### autoInjectable()

@@ -59,0 +81,0 @@ Class decorator factory that replaces the decorated class' constructor with

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc