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

feat(context): add binding.apply(templateFn) #2119

Merged
merged 2 commits into from Dec 6, 2018

Conversation

raymondfeng
Copy link
Contributor

@raymondfeng raymondfeng commented Dec 4, 2018

It allows a binding to be configured using a template function that can consistently set up bindings for certain scope/tags.

For example,

const serverTemplate = (binding: Binding) =>
  binding.inScope(BindingScope.SINGLETON).tag('server');
const serverBinding = new Binding<RestServer>('servers.RestServer1');
serverBinding.apply(serverTemplate);

Checklist

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation LGTM, I have few minor comments for your consideration.

No further review is needed as far as I am concerned.

docs/site/Binding.md Show resolved Hide resolved
permalink: /doc/en/lb4/Binding.html
---

## What is Binding?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an awesome addition to our docs! ❤️

docs/site/Context.md Outdated Show resolved Hide resolved
packages/context/test/unit/binding.unit.ts Outdated Show resolved Hide resolved
It allows a binding to be configured using a template function
that can consistently set up bindings for certain scope/tags.
@raymondfeng raymondfeng merged commit 058b19a into master Dec 6, 2018
@raymondfeng raymondfeng deleted the apply-binding-template branch December 6, 2018 16:19
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

Successfully merging this pull request may close these issues.

None yet

2 participants