Skip to content

Drop injections, add ES2015 class support, rewrite in ES2015

Compare
Choose a tag to compare
@rdner rdner released this 20 Feb 14:16
· 85 commits to master since this release

Had to drop current DI feature. It causes a lot of problems when using new JS classes.

So, previously we were able to inject services like this:

function Module($uhr, $logger, someConfigSection) {
  this._$uhr = $uhr;
  this._$logger = $logger;
  this._config = someConfigSection || {};
}

And since Service Locator 2.0:

function Module(locator) {
  this._uhr = locator.resolve('uhr');
  this._logger = locator.resolve('logger');
  this._config = locator.resolve('config').someConfigSection;
}

Or with classes:

class Module {
  consructor(locator) {
    this._uhr = locator.resolve('uhr');
    this._logger = locator.resolve('logger');
    this._config = locator.resolve('config').someConfigSection;
  }
}

Also, better performance and less bundle size is expected because of this.