refactor(di): simplify Injector API
This commit is contained in:
@ -30,19 +30,11 @@ export class Injector {
|
||||
}
|
||||
|
||||
get(token) {
|
||||
return this.getByKey(Key.get(token));
|
||||
return this._getByKey(Key.get(token), false, false);
|
||||
}
|
||||
|
||||
asyncGet(token) {
|
||||
return this.asyncGetByKey(Key.get(token));
|
||||
}
|
||||
|
||||
getByKey(key:Key) {
|
||||
return this._getByKey(key, false, false);
|
||||
}
|
||||
|
||||
asyncGetByKey(key:Key) {
|
||||
return this._getByKey(key, true, false);
|
||||
return this._getByKey(Key.get(token), true, false);
|
||||
}
|
||||
|
||||
createChild(bindings:List):Injector {
|
||||
|
@ -13,6 +13,8 @@ export class Key {
|
||||
}
|
||||
|
||||
static get(token) {
|
||||
if (token instanceof Key) return token;
|
||||
|
||||
if (MapWrapper.contains(_allKeys, token)) {
|
||||
return MapWrapper.get(_allKeys, token)
|
||||
}
|
||||
|
Reference in New Issue
Block a user