Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for @inject decorator #2

Closed
e2tox opened this issue Nov 30, 2016 · 1 comment
Closed

Add documentation for @inject decorator #2

e2tox opened this issue Nov 30, 2016 · 1 comment

Comments

@e2tox
Copy link
Collaborator

e2tox commented Nov 30, 2016

@Inject will do dependency injection when user create a new agent class.

e.g

class Calculator {
   add(left:number, right: number): number {
     return left + right;
   }
}

@agent('awesome')
class MyAgent {

   @inject(Calculator)
   calculator: Calculator

}


const agent = new MyAgent();

console.log(agent.calculator.add(1,3));
// 4
@e2tox
Copy link
Collaborator Author

e2tox commented Nov 30, 2016

This @Inject decorator already included in the latest release on npm

@e2tox e2tox changed the title Add documentation for new @inject Add documentation for new @inject decorator Nov 30, 2016
@e2tox e2tox changed the title Add documentation for new @inject decorator Add documentation for @inject decorator Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants