Skip to content

Releases: mattias800/diskajs

Removed .babelrc

26 Feb 13:49
Compare
Choose a tag to compare

.babelrc used to build diska is no longer included in distributed package.

Added default injector

23 Feb 20:46
Compare
Choose a tag to compare
  • Bug fix
  • New way of creating instances which doesn't create an intermediary object of type Temp. Types are now correct in all ways.
  • Added defaultInjector which is empty, and can be used when not needing to bind any types explicitly in a module.
import { defaultInjector } from "diskajs";
import MySweetClass from "./MySweetClass";

let obj = defaultInjector.get(MySweetClass);

Added support for injecting the injector

19 Jan 17:10
Compare
Choose a tag to compare

If you for some reason need the injector to manually get instances (for example for conditional instantiation), you can now inject it just like any other object.

import {Inject, Injector, Singleton} from "diskajs";

@Inject(Injector)
@Singleton()
export default class ClassWithInjector {

  injector:Injector;

  constructor(injector:Injector) {
    this.injector = injector;  
  }

}

Support for ES7 decorators

24 Dec 09:56
Compare
Choose a tag to compare

Major feature

Decorators

This release adds support for decorators.

@Inject(..)
@singleton()

Add @Inject() decoration to any class that is instantiated by diska. Add types to be injected as parameters.
Add @singleton() and there will only be one instance created by that injector.

See documentation for more information.

Breaking changes

Constructor argument name based injection is no longer supported.
Previously, diska could look up a type based on argument name. From now on, you must use @Inject() or add static inject() method to class.