Skip to content

Commit

Permalink
chore(di): Remove static method InjectorService.set
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Remove static method InjectorService.set. No alternative
  • Loading branch information
Romakita committed Dec 23, 2018
1 parent 628e455 commit 17679c3
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions packages/di/src/services/InjectorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import {$log} from "ts-log-debug";
import {Provider} from "../class/Provider";
import {InjectionError} from "../errors/InjectionError";
import {InjectionScopeError} from "../errors/InjectionScopeError";
import {IInjectableMethod, IProvider, ProviderScope} from "../interfaces";
import {IInjectableMethod, ProviderScope} from "../interfaces";
import {IInjectableProperties, IInjectablePropertyService, IInjectablePropertyValue} from "../interfaces/IInjectableProperties";
import {ProviderType} from "../interfaces/ProviderType";
import {GlobalProviders, registerFactory, registerProvider} from "../registries/ProviderRegistry";
import {GlobalProviders, registerFactory} from "../registries/ProviderRegistry";

let globalInjector: any;

Expand Down Expand Up @@ -601,29 +601,6 @@ export class InjectorService extends Map<RegistryKey, Provider<any>> {
static invokeMethod(handler: any, options: IInjectableMethod<any> | any[]) {
return globalInjector.invokeMethod(handler, options);
}

/**
* Set a new provider from providerSetting.
* @param provider provide token.
* @param instance Instance
* @deprecated Use registerProvider or registerService or registerFactory instead of
*/
@Deprecated("Use registerService(), registerFactory() or registerProvider() util instead of")
/* istanbul ignore next */
static set(provider: IProvider<any> | any, instance?: any) {
if (!provider.provide) {
provider = {
provide: provider,
type: "factory",
useClass: provider,
instance: instance || provider
};
}

registerProvider(provider);

return InjectorService;
}
}

/**
Expand Down

0 comments on commit 17679c3

Please sign in to comment.