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

Register by config object #6

Open
NickQiZhu opened this issue Oct 17, 2013 · 1 comment
Open

Register by config object #6

NickQiZhu opened this issue Oct 17, 2013 · 1 comment
Milestone

Comments

@NickQiZhu
Copy link
Owner

Something like:

ctx.register({
  SomeService: {
    type: ServiceType,
    args: [args, for, some, service]
  }

  // If you wanted to get fancy
  // You could even allow referencing other
  // services by name.
  AnotherService: {
    type: AnotherType,
    args: ['%SomeService%', other, args]
  },

  // Allow the ctx container to register singleton objects
  // (not just class constructors
  someConfig: {
    foo: 'bar',
    faz: 'baz
  }
});

For larger applications, it would really clean things up to be able to separate our your ctx wiring from other application logic.

@rr-
Copy link

rr- commented Aug 31, 2014

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants