Skip to content

Configurable Injection #6

Description

@ecowden

Every now and then I find I want some extra control over injection. For instance, I may have a factory function that creates a class, so I name it's file upper case; or the filename isn't a legal JavaScript argument name. It would be nice to be able to override the default guessing behavior.

Maybe something like:

// Badly-Named-Class-Factory.js

module.exports = function factory(injectMe) {
  return class SomeClass {
    // ...
  }
}

module.exports.$plutoConfig = {
  strategy: 'factory', // treat this as a factory function
  name: 'SomeClass' // change the name of the binding
}

Note: this is a really dumb example, don't actually write code like this.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions