Skip to content

Commit 7d790b1

Browse files
committed
Merge pull request DefinitelyTyped#4501 from dimasty/master
Add Decorator definition to IModule
2 parents 0a82ec0 + 3e6f633 commit 7d790b1

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

angularjs/angular-tests.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ mod.constant(My.Namespace);
201201
mod.value('name', 23);
202202
mod.value('name', "23");
203203
mod.value(My.Namespace);
204+
mod.decorator('name', function($scope:ng.IScope){ });
205+
mod.decorator('name', ['$scope', <any>function($scope: ng.IScope){ }]);
206+
204207

205208
class TestProvider implements ng.IServiceProvider {
206209
constructor(private $scope: ng.IScope) {

angularjs/angular.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,14 @@ declare module angular {
384384
value(name: string, value: any): IModule;
385385
value(object: Object): IModule;
386386

387+
/**
388+
* Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service.
389+
* @param name The name of the service to decorate
390+
* @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to.
391+
*/
392+
decorator(name:string, decoratorConstructor: Function): IModule;
393+
decorator(name:string, inlineAnnotatedConstructor: any[]): IModule;
394+
387395
// Properties
388396
name: string;
389397
requires: string[];

0 commit comments

Comments
 (0)