Skip to content

Commit

Permalink
chore(di): Remove static method InjectorService.service
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Remove static method InjectorService.service. Use registerService instead of.
  • Loading branch information
Romakita committed Dec 23, 2018
1 parent 1215d3c commit 407a487
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions packages/di/src/services/InjectorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {InjectionScopeError} from "../errors/InjectionScopeError";
import {IInjectableMethod, IProvider, ProviderScope} from "../interfaces";
import {IInjectableProperties, IInjectablePropertyService, IInjectablePropertyValue} from "../interfaces/IInjectableProperties";
import {ProviderType} from "../interfaces/ProviderType";
import {GlobalProviders, registerFactory, registerProvider, registerService} from "../registries/ProviderRegistry";
import {GlobalProviders, registerFactory, registerProvider} from "../registries/ProviderRegistry";

let globalInjector: any;

Expand Down Expand Up @@ -663,38 +663,6 @@ export class InjectorService extends Map<RegistryKey, Provider<any>> {
return globalInjector.load();
}

/**
* Add a new service in the registry. This service will be constructed when `InjectorService`will loaded.
*
* #### Example
*
* ```typescript
* import {InjectorService} from "@tsed/common";
*
* export default class MyFooService {
* constructor(){}
* getFoo() {
* return "test";
* }
* }
*
* InjectorService.service(MyFooService);
* const injector = new InjectorService();
* injector.load();
*
* const myFooService = injector.get<MyFooService>(MyFooService);
* myFooService.getFoo(); // test
* ```
*
* @param target The class to add in registry.
* @deprecated Use registerService or registerFactory instead of.
*/
@Deprecated("Use registerService() util instead of")
/* istanbul ignore next */
static service(target: any) {
return registerService(target);
}

/**
* Add a new factory in `InjectorService` registry.
*
Expand Down

0 comments on commit 407a487

Please sign in to comment.