Socket
Socket
Sign inDemoInstall

rsdi

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rsdi - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

1

definitions/FactoryDefinition.d.ts

@@ -6,5 +6,4 @@ import BaseDefinition from "../definitions/BaseDefinition";

private readonly factory;
private value;
constructor(factory: Factory);
resolve: <T>(container: IDIContainer) => T;
}

@@ -25,7 +25,3 @@ "use strict";

_this.resolve = function (container) {
if (_this.value !== undefined) {
return _this.value;
}
_this.value = _this.factory(container);
return _this.value;
return _this.factory(container);
};

@@ -32,0 +28,0 @@ _this.factory = factory;

1

DIContainer.d.ts

@@ -11,2 +11,3 @@ import { IDefinition } from "./definitions/IDefinition";

private definitions;
private resolved;
get<T>(name: string): T;

@@ -13,0 +14,0 @@ addDefinition(name: DefinitionName, definition: IDefinition): void;

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

this.definitions = {};
this.resolved = {};
}

@@ -27,4 +28,8 @@ DIContainer.prototype.get = function (name) {

}
if (this.resolved[name] !== undefined) {
return this.resolved[name];
}
var definition = this.definitions[name];
return definition.resolve(this);
this.resolved[name] = definition.resolve(this);
return this.resolved[name];
};

@@ -31,0 +36,0 @@ DIContainer.prototype.addDefinition = function (name, definition) {

{
"name": "rsdi",
"version": "0.0.10",
"version": "0.0.11",
"description": "dependency injection container",

@@ -5,0 +5,0 @@ "scripts": {

@@ -21,4 +21,2 @@ # RSDI - Dependency Injection Container

function configureHistory(container: IDIContainer): History {
// this factory will be called only once, during first resolving
// then resolved version will be returned
const history = createBrowserHistory();

@@ -37,7 +35,7 @@ const env = container.get("ENV");

const history = container.get<History>("BrowserHistory"); // History singleton will be returned
```
**All definitions are resolved once and their result is kept during the life of the container.**
```
## Motivation

@@ -44,0 +42,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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