-
Notifications
You must be signed in to change notification settings - Fork 21
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 #28 from remojansen/master
Implemented inversify/InversifyJS/issues/362
- Loading branch information
Showing
28 changed files
with
129 additions
and
196 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,4 +58,5 @@ test/**/*.js | |
type_definitions/**/*.js | ||
type_definitions/*.js | ||
|
||
.typingsrc | ||
.typingsrc | ||
dts |
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 |
---|---|---|
|
@@ -20,16 +20,11 @@ An utility that allows developers to declare [InversifyJS](http://inversify.io/) | |
You can install `inversify-binding-decorators` using npm: | ||
|
||
``` | ||
$ npm install --save inversify inversify-binding-decorators reflect-metadata | ||
$ npm install --save-dev inversify-dts | ||
$ npm install [email protected] inversify-binding-decorators reflect-metadata --save | ||
``` | ||
|
||
If you are workiong with TypeScript you will need the following `.d.ts` files: | ||
|
||
``` | ||
/// <reference path="node_modules/reflect-metadata/reflect-metadata.d.ts" /> | ||
/// <reference path="node_modules/inversify-dts/inversify-binding-decorators/inversify-binding-decorators.d.ts" /> | ||
``` | ||
The `inversify-binding-decorators` type definitions are included in the npm module and require TypeScript 2.0. | ||
Please refer to the [InversifyJS documentation](https://github.com/inversify/InversifyJS#installation) to learn more about the installation process. | ||
|
||
### The basics | ||
The [InversifyJS](http://inversify.io/) API allows us to delcare bindings using a fluent API: | ||
|
@@ -84,9 +79,6 @@ class Shuriken implements ThrowableWeapon { | |
|
||
``` | ||
|
||
A basic example can be found at the | ||
[inversify-code-samples](https://github.com/inversify/inversify-code-samples/tree/master/inversify-binding-decorators) repository. | ||
|
||
### Using classes, string literals & symbols as identifiers | ||
When you invoke `@provide` using classes: | ||
|
||
|
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,7 +1,11 @@ | ||
import fluentProvide from "../decorator/fluent_provide"; | ||
import interfaces from "../interfaces/interfaces"; | ||
import { interfaces as inversifyInterfaces } from "inversify"; | ||
|
||
function makeFluentProvideDecorator(kernel: inversify.interfaces.Kernel) { | ||
return fluentProvide(kernel); | ||
function makeFluentProvideDecorator(kernel: inversifyInterfaces.Kernel) { | ||
let result: (serviceIdentifier: inversifyInterfaces.ServiceIdentifier<any>) => interfaces.ProvideInWhenOnSyntax<any> = null; | ||
result = fluentProvide(kernel); | ||
return result; | ||
} | ||
|
||
export default makeFluentProvideDecorator; |
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
Oops, something went wrong.