reactive-di
Advanced tools
Comparing version 4.0.13 to 4.0.14
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="4.0.14"></a> | ||
## [4.0.14](https://github.com/zerkalica/reactive-di/compare/v4.0.13...v4.0.14) (2017-09-13) | ||
<a name="4.0.13"></a> | ||
@@ -7,0 +12,0 @@ ## [4.0.13](https://github.com/zerkalica/reactive-di/compare/v4.0.12...v4.0.13) (2017-09-13) |
@@ -146,5 +146,6 @@ import { detached, memkey } from 'lom_atom'; | ||
var Injector = function () { | ||
function Injector(items, sheetProcessor, displayName, instance, cache) { | ||
function Injector(items, sheetProcessor, state, displayName, instance, cache) { | ||
this._resolved = false; | ||
this._listeners = undefined; | ||
this._state = state; | ||
this._instance = instance || 0; | ||
@@ -203,6 +204,12 @@ this.displayName = displayName || '$'; | ||
if (value === undefined) { | ||
value = this._cache[id] = this._fastNew(key); | ||
value = this._cache[id] = this.invoke(key); | ||
var depName = (key.displayName || key.name) + (this._instance > 0 ? '[' + this._instance + ']' : ''); | ||
value.displayName = this.displayName + "." + depName; | ||
var state = this._state === undefined ? undefined : this._state[depName]; | ||
if (!value.displayName) { | ||
value.displayName = this.displayName + '.' + (key.displayName || key.name) + (this._instance > 0 ? '[' + this._instance + ']' : ''); | ||
if (state && _typeof(state) === 'object') { | ||
for (var prop in state) { | ||
value[prop] = state[prop]; | ||
} | ||
} | ||
@@ -222,59 +229,65 @@ } else if (value instanceof Alias) { | ||
Injector.prototype._fastNew = function _fastNew(key) { | ||
var a = this.resolve(key.deps || (key._r === undefined ? undefined : key._r[1])); | ||
Injector.prototype.invoke = function invoke(key) { | ||
var isFn = key.theme; | ||
var deps = key.deps; | ||
switch (a.length) { | ||
case 0: | ||
return new key(); | ||
if (key._r !== undefined) { | ||
isFn = key._r[0] === 2; | ||
deps = deps || key._r[1]; | ||
} | ||
case 1: | ||
return new key(a[0]); | ||
var a = this.resolve(deps); | ||
case 2: | ||
return new key(a[0], a[1]); | ||
if (isFn) { | ||
switch (a.length) { | ||
case 0: | ||
return key(); | ||
case 3: | ||
return new key(a[0], a[1], a[2]); | ||
case 1: | ||
return key(a[0]); | ||
case 4: | ||
return new key(a[0], a[1], a[2], a[3]); | ||
case 2: | ||
return key(a[0], a[1]); | ||
case 5: | ||
return new key(a[0], a[1], a[2], a[3], a[4]); | ||
case 3: | ||
return key(a[0], a[1], a[2]); | ||
case 6: | ||
return new key(a[0], a[1], a[2], a[3], a[4], a[5]); | ||
case 4: | ||
return key(a[0], a[1], a[2], a[3]); | ||
default: | ||
return new (Function.prototype.bind.apply(key, [null].concat(a)))(); | ||
case 5: | ||
return key(a[0], a[1], a[2], a[3], a[4]); | ||
case 6: | ||
return key(a[0], a[1], a[2], a[3], a[4], a[5]); | ||
default: | ||
return key.apply(undefined, a); | ||
} | ||
} | ||
}; | ||
Injector.prototype.invoke = function invoke(key) { | ||
var a = this.resolve(key.deps || (key._r === undefined ? undefined : key._r[1])); | ||
switch (a.length) { | ||
case 0: | ||
return key(); | ||
return new key(); | ||
case 1: | ||
return key(a[0]); | ||
return new key(a[0]); | ||
case 2: | ||
return key(a[0], a[1]); | ||
return new key(a[0], a[1]); | ||
case 3: | ||
return key(a[0], a[1], a[2]); | ||
return new key(a[0], a[1], a[2]); | ||
case 4: | ||
return key(a[0], a[1], a[2], a[3]); | ||
return new key(a[0], a[1], a[2], a[3]); | ||
case 5: | ||
return key(a[0], a[1], a[2], a[3], a[4]); | ||
return new key(a[0], a[1], a[2], a[3], a[4]); | ||
case 6: | ||
return key(a[0], a[1], a[2], a[3], a[4], a[5]); | ||
return new key(a[0], a[1], a[2], a[3], a[4], a[5]); | ||
default: | ||
return key.apply(undefined, a); | ||
return new (Function.prototype.bind.apply(key, [null].concat(a)))(); | ||
} | ||
@@ -353,3 +366,3 @@ }; | ||
Injector.prototype.copy = function copy(items, displayName, instance) { | ||
return new Injector(items, this._sheetManager, this.displayName + '.' + displayName, instance, Object.create(this._cache)); | ||
return new Injector(items, this._sheetManager, this._state, this.displayName + '.' + displayName, instance, Object.create(this._cache)); | ||
}; | ||
@@ -532,6 +545,4 @@ | ||
var cns = _this.constructor; | ||
var parentInjector = props.__lom_ctx || rootInjector; | ||
_this._render = cns.render; | ||
var injectorName = cns.displayName + (cns.instance ? '[' + cns.instance + ']' : ''); | ||
_this._injector = parentInjector.copy(_this._render.aliases, injectorName, cns.instance); | ||
_this._injector = (props.__lom_ctx || rootInjector).copy(_this._render.aliases, cns.displayName + (cns.instance ? '[' + cns.instance + ']' : ''), cns.instance); | ||
cns.instance++; | ||
@@ -542,3 +553,3 @@ return _this; | ||
AtomizedComponent.prototype.toString = function toString() { | ||
return this._injector.displayName + "." + this.constructor.displayName; | ||
return this._injector.displayName; | ||
}; | ||
@@ -545,0 +556,0 @@ |
@@ -150,5 +150,6 @@ 'use strict'; | ||
var Injector = function () { | ||
function Injector(items, sheetProcessor, displayName, instance, cache) { | ||
function Injector(items, sheetProcessor, state, displayName, instance, cache) { | ||
this._resolved = false; | ||
this._listeners = undefined; | ||
this._state = state; | ||
this._instance = instance || 0; | ||
@@ -207,6 +208,12 @@ this.displayName = displayName || '$'; | ||
if (value === undefined) { | ||
value = this._cache[id] = this._fastNew(key); | ||
value = this._cache[id] = this.invoke(key); | ||
var depName = (key.displayName || key.name) + (this._instance > 0 ? '[' + this._instance + ']' : ''); | ||
value.displayName = this.displayName + "." + depName; | ||
var state = this._state === undefined ? undefined : this._state[depName]; | ||
if (!value.displayName) { | ||
value.displayName = this.displayName + '.' + (key.displayName || key.name) + (this._instance > 0 ? '[' + this._instance + ']' : ''); | ||
if (state && _typeof(state) === 'object') { | ||
for (var prop in state) { | ||
value[prop] = state[prop]; | ||
} | ||
} | ||
@@ -226,59 +233,65 @@ } else if (value instanceof Alias) { | ||
Injector.prototype._fastNew = function _fastNew(key) { | ||
var a = this.resolve(key.deps || (key._r === undefined ? undefined : key._r[1])); | ||
Injector.prototype.invoke = function invoke(key) { | ||
var isFn = key.theme; | ||
var deps = key.deps; | ||
switch (a.length) { | ||
case 0: | ||
return new key(); | ||
if (key._r !== undefined) { | ||
isFn = key._r[0] === 2; | ||
deps = deps || key._r[1]; | ||
} | ||
case 1: | ||
return new key(a[0]); | ||
var a = this.resolve(deps); | ||
case 2: | ||
return new key(a[0], a[1]); | ||
if (isFn) { | ||
switch (a.length) { | ||
case 0: | ||
return key(); | ||
case 3: | ||
return new key(a[0], a[1], a[2]); | ||
case 1: | ||
return key(a[0]); | ||
case 4: | ||
return new key(a[0], a[1], a[2], a[3]); | ||
case 2: | ||
return key(a[0], a[1]); | ||
case 5: | ||
return new key(a[0], a[1], a[2], a[3], a[4]); | ||
case 3: | ||
return key(a[0], a[1], a[2]); | ||
case 6: | ||
return new key(a[0], a[1], a[2], a[3], a[4], a[5]); | ||
case 4: | ||
return key(a[0], a[1], a[2], a[3]); | ||
default: | ||
return new (Function.prototype.bind.apply(key, [null].concat(a)))(); | ||
case 5: | ||
return key(a[0], a[1], a[2], a[3], a[4]); | ||
case 6: | ||
return key(a[0], a[1], a[2], a[3], a[4], a[5]); | ||
default: | ||
return key.apply(undefined, a); | ||
} | ||
} | ||
}; | ||
Injector.prototype.invoke = function invoke(key) { | ||
var a = this.resolve(key.deps || (key._r === undefined ? undefined : key._r[1])); | ||
switch (a.length) { | ||
case 0: | ||
return key(); | ||
return new key(); | ||
case 1: | ||
return key(a[0]); | ||
return new key(a[0]); | ||
case 2: | ||
return key(a[0], a[1]); | ||
return new key(a[0], a[1]); | ||
case 3: | ||
return key(a[0], a[1], a[2]); | ||
return new key(a[0], a[1], a[2]); | ||
case 4: | ||
return key(a[0], a[1], a[2], a[3]); | ||
return new key(a[0], a[1], a[2], a[3]); | ||
case 5: | ||
return key(a[0], a[1], a[2], a[3], a[4]); | ||
return new key(a[0], a[1], a[2], a[3], a[4]); | ||
case 6: | ||
return key(a[0], a[1], a[2], a[3], a[4], a[5]); | ||
return new key(a[0], a[1], a[2], a[3], a[4], a[5]); | ||
default: | ||
return key.apply(undefined, a); | ||
return new (Function.prototype.bind.apply(key, [null].concat(a)))(); | ||
} | ||
@@ -357,3 +370,3 @@ }; | ||
Injector.prototype.copy = function copy(items, displayName, instance) { | ||
return new Injector(items, this._sheetManager, this.displayName + '.' + displayName, instance, Object.create(this._cache)); | ||
return new Injector(items, this._sheetManager, this._state, this.displayName + '.' + displayName, instance, Object.create(this._cache)); | ||
}; | ||
@@ -536,6 +549,4 @@ | ||
var cns = _this.constructor; | ||
var parentInjector = props.__lom_ctx || rootInjector; | ||
_this._render = cns.render; | ||
var injectorName = cns.displayName + (cns.instance ? '[' + cns.instance + ']' : ''); | ||
_this._injector = parentInjector.copy(_this._render.aliases, injectorName, cns.instance); | ||
_this._injector = (props.__lom_ctx || rootInjector).copy(_this._render.aliases, cns.displayName + (cns.instance ? '[' + cns.instance + ']' : ''), cns.instance); | ||
cns.instance++; | ||
@@ -546,3 +557,3 @@ return _this; | ||
AtomizedComponent.prototype.toString = function toString() { | ||
return this._injector.displayName + "." + this.constructor.displayName; | ||
return this._injector.displayName; | ||
}; | ||
@@ -549,0 +560,0 @@ |
@@ -150,5 +150,6 @@ (function (global, factory) { | ||
var Injector = function () { | ||
function Injector(items, sheetProcessor, displayName, instance, cache) { | ||
function Injector(items, sheetProcessor, state, displayName, instance, cache) { | ||
this._resolved = false; | ||
this._listeners = undefined; | ||
this._state = state; | ||
this._instance = instance || 0; | ||
@@ -207,6 +208,12 @@ this.displayName = displayName || '$'; | ||
if (value === undefined) { | ||
value = this._cache[id] = this._fastNew(key); | ||
value = this._cache[id] = this.invoke(key); | ||
var depName = (key.displayName || key.name) + (this._instance > 0 ? '[' + this._instance + ']' : ''); | ||
value.displayName = this.displayName + "." + depName; | ||
var state = this._state === undefined ? undefined : this._state[depName]; | ||
if (!value.displayName) { | ||
value.displayName = this.displayName + '.' + (key.displayName || key.name) + (this._instance > 0 ? '[' + this._instance + ']' : ''); | ||
if (state && _typeof(state) === 'object') { | ||
for (var prop in state) { | ||
value[prop] = state[prop]; | ||
} | ||
} | ||
@@ -226,59 +233,65 @@ } else if (value instanceof Alias) { | ||
Injector.prototype._fastNew = function _fastNew(key) { | ||
var a = this.resolve(key.deps || (key._r === undefined ? undefined : key._r[1])); | ||
Injector.prototype.invoke = function invoke(key) { | ||
var isFn = key.theme; | ||
var deps = key.deps; | ||
switch (a.length) { | ||
case 0: | ||
return new key(); | ||
if (key._r !== undefined) { | ||
isFn = key._r[0] === 2; | ||
deps = deps || key._r[1]; | ||
} | ||
case 1: | ||
return new key(a[0]); | ||
var a = this.resolve(deps); | ||
case 2: | ||
return new key(a[0], a[1]); | ||
if (isFn) { | ||
switch (a.length) { | ||
case 0: | ||
return key(); | ||
case 3: | ||
return new key(a[0], a[1], a[2]); | ||
case 1: | ||
return key(a[0]); | ||
case 4: | ||
return new key(a[0], a[1], a[2], a[3]); | ||
case 2: | ||
return key(a[0], a[1]); | ||
case 5: | ||
return new key(a[0], a[1], a[2], a[3], a[4]); | ||
case 3: | ||
return key(a[0], a[1], a[2]); | ||
case 6: | ||
return new key(a[0], a[1], a[2], a[3], a[4], a[5]); | ||
case 4: | ||
return key(a[0], a[1], a[2], a[3]); | ||
default: | ||
return new (Function.prototype.bind.apply(key, [null].concat(a)))(); | ||
case 5: | ||
return key(a[0], a[1], a[2], a[3], a[4]); | ||
case 6: | ||
return key(a[0], a[1], a[2], a[3], a[4], a[5]); | ||
default: | ||
return key.apply(undefined, a); | ||
} | ||
} | ||
}; | ||
Injector.prototype.invoke = function invoke(key) { | ||
var a = this.resolve(key.deps || (key._r === undefined ? undefined : key._r[1])); | ||
switch (a.length) { | ||
case 0: | ||
return key(); | ||
return new key(); | ||
case 1: | ||
return key(a[0]); | ||
return new key(a[0]); | ||
case 2: | ||
return key(a[0], a[1]); | ||
return new key(a[0], a[1]); | ||
case 3: | ||
return key(a[0], a[1], a[2]); | ||
return new key(a[0], a[1], a[2]); | ||
case 4: | ||
return key(a[0], a[1], a[2], a[3]); | ||
return new key(a[0], a[1], a[2], a[3]); | ||
case 5: | ||
return key(a[0], a[1], a[2], a[3], a[4]); | ||
return new key(a[0], a[1], a[2], a[3], a[4]); | ||
case 6: | ||
return key(a[0], a[1], a[2], a[3], a[4], a[5]); | ||
return new key(a[0], a[1], a[2], a[3], a[4], a[5]); | ||
default: | ||
return key.apply(undefined, a); | ||
return new (Function.prototype.bind.apply(key, [null].concat(a)))(); | ||
} | ||
@@ -357,3 +370,3 @@ }; | ||
Injector.prototype.copy = function copy(items, displayName, instance) { | ||
return new Injector(items, this._sheetManager, this.displayName + '.' + displayName, instance, Object.create(this._cache)); | ||
return new Injector(items, this._sheetManager, this._state, this.displayName + '.' + displayName, instance, Object.create(this._cache)); | ||
}; | ||
@@ -536,6 +549,4 @@ | ||
var cns = _this.constructor; | ||
var parentInjector = props.__lom_ctx || rootInjector; | ||
_this._render = cns.render; | ||
var injectorName = cns.displayName + (cns.instance ? '[' + cns.instance + ']' : ''); | ||
_this._injector = parentInjector.copy(_this._render.aliases, injectorName, cns.instance); | ||
_this._injector = (props.__lom_ctx || rootInjector).copy(_this._render.aliases, cns.displayName + (cns.instance ? '[' + cns.instance + ']' : ''), cns.instance); | ||
cns.instance++; | ||
@@ -546,3 +557,3 @@ return _this; | ||
AtomizedComponent.prototype.toString = function toString() { | ||
return this._injector.displayName + "." + this.constructor.displayName; | ||
return this._injector.displayName; | ||
}; | ||
@@ -549,0 +560,0 @@ |
{ | ||
"name": "reactive-di", | ||
"version": "4.0.13", | ||
"version": "4.0.14", | ||
"description": "Reactive dependency injection", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -5,5 +5,5 @@ # Reactive DI [![Build Status](https://secure.travis-ci.org/zerkalica/reactive-di.png)](http://travis-ci.org/zerkalica/reactive-di) | ||
Dependency injection with reactivity, applied to react-like components, css-in-js, unobtrusive state-management. Compatible with flow, react, but free from framework lock-in (no React.createElement, Inferno.createVNode), etc. | ||
Dependency injection with reactivity unobtrusive state-management in [mobx](https://mobx.js.org/) manner, applied to react-like components, css-in-js. Compatible with flow, react, but free from framework lock-in (no React.createElement, Inferno.createVNode), etc. Size about 10kb reactive-di.min.js + 11kb lom_atom.min.js | ||
Examples: [source](https://github.com/zerkalica/rdi-examples), [demo](http://zerkalica.github.io/rdi-examples/) | ||
[example source](https://github.com/zerkalica/rdi-examples), [demo](http://zerkalica.github.io/rdi-examples/), [todomvc benchmark](http://mol.js.org/app/bench/#bench=https%3A%2F%2Fzerkalica.github.io%2Ftodomvc%2Fbenchmark%2F/sample=preact-lom-rdi~preact-raw~preact-mobx) | ||
@@ -18,3 +18,3 @@ <!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 --> | ||
- [State management based on lom_atom](#state-management-based-on-lomatom) | ||
- [Asyncronous code](#asyncronous-code) | ||
- [Asynchronous code](#asynchronous-code) | ||
- [Error handling](#error-handling) | ||
@@ -29,2 +29,3 @@ - [Loading status handing](#loading-status-handing) | ||
- [Logging](#logging) | ||
- [Map config to objects](#map-config-to-objects) | ||
- [Credits](#credits) | ||
@@ -69,3 +70,3 @@ | ||
In: | ||
Setup: | ||
@@ -103,3 +104,7 @@ ```js | ||
global['lom_h'] = lomCreateElement | ||
``` | ||
Usage: | ||
```js | ||
class HelloContext { | ||
@@ -192,3 +197,3 @@ @mem name = '' | ||
### Asyncronous code | ||
### Asynchronous code | ||
@@ -523,2 +528,3 @@ Loading actual state: | ||
import {mem} from 'lom_atom' | ||
import type {NamesOf} from 'lom_atom' | ||
@@ -540,9 +546,11 @@ class ThemeVars { | ||
props: {}, | ||
{theme, vars}: {theme: MyTheme, vars: ThemeVars} | ||
{theme, vars}: {theme: NamesOf<typeof MyTheme>, vars: ThemeVars} | ||
) { | ||
return <div class={theme.wrapper}>...<button onClick={() => vars.color = 'green'}>Change color</button></div> | ||
return <div class={theme.wrapper}>... | ||
<button onClick={() => vars.color = 'green'}>Change color</button> | ||
</div> | ||
} | ||
``` | ||
Styles automatically mounts/unmounts with component. Changing ``` vars.color ``` automatically rebuild and remount css. | ||
Styles automatically mounts/unmounts together with component. Changing ``` vars.color ``` automatically rebuilds and remounts css. | ||
@@ -578,3 +586,3 @@ ### Passing component props to its depenendencies | ||
We still can use any react/preact/inferno components together rdi components. | ||
We still can use any react/preact/inferno components together with rdi components. | ||
@@ -625,4 +633,53 @@ ### Logging | ||
### Map config to objects | ||
Configs maped to object properties by class names. | ||
```js | ||
// @flow | ||
import {mem} from 'lom_atom' | ||
import {Injector} from 'reactive-di' | ||
const defaultDeps = [] | ||
const injector = new Injector([], undefined, { | ||
SomeService: { | ||
name: 'test', | ||
id: 123 | ||
} | ||
}) | ||
class SomeService { | ||
// setup babel-plugin-transform-metadata or define displayName, if js-uglify used | ||
static displayName = 'SomeService' | ||
@mem name = '' | ||
id = 0 | ||
} | ||
const someService: SomeService = injector.value(SomeService) | ||
someService.name === 'test' | ||
someService.id === 123 | ||
``` | ||
[babel-plugin-transform-metadata](https://github.com/zerkalica/babel-plugin-transform-metadata) can generate displayName. To enable it, add ``` ["transform-metadata", {"addDisplayName": true}] ``` into .babelrc. | ||
Example .babelrc: | ||
```json | ||
{ | ||
"presets": [ | ||
"flow", | ||
"react", | ||
["es2015", {"loose": true}] | ||
], | ||
"plugins": [ | ||
["transform-metadata", {"addDisplayName": true}], | ||
"transform-decorators-legacy", | ||
["transform-react-jsx", {"pragma": "lom_h"}] | ||
] | ||
} | ||
``` | ||
## Credits | ||
* [mol](https://github.com/eigenmethod/mol) OORP ideas | ||
* [Ninject](https://github.com/ninject/Ninject) best dependency injector, writen in C#. | ||
@@ -632,2 +689,1 @@ * [inversify.io](http://inversify.io/) nice try of reimplementing Ninject in typescript. | ||
* [babel-plugin-angular2-annotations](https://github.com/shuhei/babel-plugin-angular2-annotations) ideas of metadata for resolving dependencies. | ||
* [babel-plugin-type-metadata](https://github.com/stephanos/babel-plugin-type-metadata) ideas of generating metadata for flowtypes. |
@@ -123,8 +123,6 @@ // @flow | ||
const cns = this.constructor | ||
const parentInjector = props.__lom_ctx || rootInjector | ||
this._render = cns.render | ||
const injectorName = cns.displayName + (cns.instance ? ('[' + cns.instance + ']') : '') | ||
this._injector = parentInjector.copy( | ||
this._injector = (props.__lom_ctx || rootInjector).copy( | ||
this._render.aliases, | ||
injectorName, | ||
cns.displayName + (cns.instance ? ('[' + cns.instance + ']') : ''), | ||
cns.instance | ||
@@ -136,3 +134,3 @@ ) | ||
toString() { | ||
return `${this._injector.displayName}.${this.constructor.displayName}` | ||
return this._injector.displayName | ||
} | ||
@@ -139,0 +137,0 @@ |
@@ -88,2 +88,5 @@ // @flow | ||
} | ||
type IState = {[ns: string]: {[id: string]: any}} | ||
export default class Injector { | ||
@@ -94,2 +97,3 @@ displayName: string | ||
_instance: number | ||
_state: IState | void | ||
@@ -99,2 +103,3 @@ constructor( | ||
sheetProcessor?: IProcessor | SheetManager, | ||
state?: IState, | ||
displayName?: string, | ||
@@ -104,2 +109,3 @@ instance?: number, | ||
) { | ||
this._state = state | ||
this._instance = instance || 0 | ||
@@ -155,8 +161,10 @@ this.displayName = displayName || '$' | ||
if (value === undefined) { | ||
value = this._cache[id] = this._fastNew(key) | ||
if (!value.displayName) { | ||
value.displayName = this.displayName | ||
+ '.' | ||
+ (key.displayName || key.name) | ||
+ (this._instance > 0 ? ('[' + this._instance + ']') : '') | ||
value = this._cache[id] = this.invoke(key) | ||
const depName = (key.displayName || key.name) + (this._instance > 0 ? ('[' + this._instance + ']') : '') | ||
value.displayName = `${this.displayName}.${depName}` | ||
const state = this._state === undefined ? undefined : this._state[depName] | ||
if (state && typeof state === 'object') { | ||
for (let prop in state) { | ||
;(value: Object)[prop] = state[prop] | ||
} | ||
} | ||
@@ -176,4 +184,24 @@ } else if (value instanceof Alias) { | ||
_fastNew<V>(key: any): V { | ||
const a = this.resolve(key.deps || (key._r === undefined ? undefined : key._r[1])) | ||
invoke<V>(key: any): V { | ||
let isFn = key.theme | ||
let deps: IArg[] | void = key.deps | ||
if (key._r !== undefined) { | ||
isFn = key._r[0] === 2 | ||
deps = deps || key._r[1] | ||
} | ||
const a = this.resolve(deps) | ||
if (isFn) { | ||
switch (a.length) { | ||
case 0: return key() | ||
case 1: return key(a[0]) | ||
case 2: return key(a[0], a[1]) | ||
case 3: return key(a[0], a[1], a[2]) | ||
case 4: return key(a[0], a[1], a[2], a[3]) | ||
case 5: return key(a[0], a[1], a[2], a[3], a[4]) | ||
case 6: return key(a[0], a[1], a[2], a[3], a[4], a[5]) | ||
default: return key(...a) | ||
} | ||
} | ||
switch (a.length) { | ||
@@ -191,16 +219,2 @@ case 0: return new key() | ||
invoke<V>(key: Function): V { | ||
const a = this.resolve(key.deps || (key._r === undefined ? undefined : key._r[1])) | ||
switch (a.length) { | ||
case 0: return key() | ||
case 1: return key(a[0]) | ||
case 2: return key(a[0], a[1]) | ||
case 3: return key(a[0], a[1], a[2]) | ||
case 4: return key(a[0], a[1], a[2], a[3]) | ||
case 5: return key(a[0], a[1], a[2], a[3], a[4]) | ||
case 6: return key(a[0], a[1], a[2], a[3], a[4], a[5]) | ||
default: return key(...a) | ||
} | ||
} | ||
_resolved: boolean = false | ||
@@ -257,2 +271,3 @@ _listeners: IListener[] | void = undefined | ||
this._sheetManager, | ||
this._state, | ||
this.displayName + '.' + displayName, | ||
@@ -259,0 +274,0 @@ instance, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
198449
2122
679