-
Notifications
You must be signed in to change notification settings - Fork 713
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from remojansen/master
Implemented #116
- Loading branch information
Showing
38 changed files
with
1,547 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
///<reference path="../interfaces/interfaces.d.ts" /> | ||
|
||
enum BindingScope { | ||
Transient, | ||
Singleton | ||
Transient = 0, | ||
Singleton = 1 | ||
} | ||
|
||
export default BindingScope; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference path="../interfaces.d.ts" /> | ||
|
||
interface SymbolConstructor { | ||
(description?: string|number): symbol; | ||
} | ||
|
||
declare var Symbol: SymbolConstructor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference path="../interfaces.d.ts" /> | ||
|
||
interface IBindingInSyntax<T> { | ||
inSingletonScope(): IBindingWhenOnSyntax<T>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
/// <reference path="../interfaces.d.ts" /> | ||
|
||
interface IBindingInWhenOnSyntax<T> { | ||
inTransientScope(): IBindingInWhenOnSyntax<T>; | ||
inSingletonScope(): IBindingInWhenOnSyntax<T>; | ||
when(constraint: (request: IRequest) => boolean): IBindingInWhenOnSyntax<T>; | ||
whenTargetNamed(name: string): IBindingInWhenOnSyntax<T>; | ||
whenTargetTagged(tag: string, value: any): IBindingInWhenOnSyntax<T>; | ||
onActivation(fn: (context: IContext, injectable: T) => T): IBindingInWhenOnSyntax<T>; | ||
} | ||
interface IBindingInWhenOnSyntax<T> extends IBindingInSyntax<T>, IBindingWhenOnSyntax<T> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference path="../interfaces.d.ts" /> | ||
|
||
interface IBindingOnSyntax<T> { | ||
onActivation(fn: (context: IContext, injectable: T) => T): IBindingWhenSyntax<T>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/// <reference path="../interfaces.d.ts" /> | ||
|
||
interface IBindingWhenOnSyntax<T> extends IBindingWhenSyntax<T>, IBindingOnSyntax<T> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/// <reference path="../interfaces.d.ts" /> | ||
|
||
interface IBindingWhenSyntax<T> { | ||
when(constraint: (request: IRequest) => boolean): IBindingOnSyntax<T>; | ||
whenTargetNamed(name: string): IBindingOnSyntax<T>; | ||
whenTargetTagged(tag: string, value: any): IBindingOnSyntax<T>; | ||
whenInjectedInto(parent: (Function|string)): IBindingOnSyntax<T>; | ||
whenParentNamed(name: string): IBindingOnSyntax<T>; | ||
whenParentTagged(tag: string, value: any): IBindingOnSyntax<T>; | ||
whenAnyAncestorIs(ancestor: (Function|string)): IBindingOnSyntax<T>; | ||
whenNoAncestorIs(ancestor: (Function|string)): IBindingOnSyntax<T>; | ||
whenAnyAncestorNamed(name: string): IBindingOnSyntax<T>; | ||
whenAnyAncestorTagged(tag: string, value: any): IBindingOnSyntax<T>; | ||
whenNoAncestorNamed(name: string): IBindingOnSyntax<T>; | ||
whenNoAncestorTagged(tag: string, value: any): IBindingOnSyntax<T>; | ||
whenAnyAncestorMatches(constraint: (request: IRequest) => boolean): IBindingOnSyntax<T>; | ||
whenNoAncestorMatches(constraint: (request: IRequest) => boolean): IBindingOnSyntax<T>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
///<reference path="../interfaces/interfaces.d.ts" /> | ||
|
||
import BindingScope from "../bindings/binding_scope"; | ||
import BindingWhenOnSyntax from "./binding_when_on_syntax"; | ||
|
||
class BindingInSyntax<T> implements IBindingInSyntax<T> { | ||
|
||
private _binding: IBinding<T>; | ||
|
||
public constructor(binding: IBinding<T>) { | ||
this._binding = binding; | ||
} | ||
|
||
public inSingletonScope(): IBindingWhenOnSyntax<T> { | ||
this._binding.scope = BindingScope.Singleton; | ||
return new BindingWhenOnSyntax<T>(this._binding); | ||
} | ||
|
||
} | ||
|
||
export default BindingInSyntax; |
Oops, something went wrong.