Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Created April 11, 2018 18:24
Show Gist options
  • Select an option

  • Save joegaudet/fa23ca36b3461085745c0132cc687a99 to your computer and use it in GitHub Desktop.

Select an option

Save joegaudet/fa23ca36b3461085745c0132cc687a99 to your computer and use it in GitHub Desktop.
// factory-registry.js
export default FactoryRegistry {
static register(name, klass) {
this._factories = this._factories || {};
this._factories[name] = klass;
}
}
// factory instance
import Factory from './factory-registry.js';
export default FactoryInstance {
build(){
// DOIT
}
}
// The problem, in dev this gets invoked, but in production
// it doesn't, is this an ember-cli build optimization to lazily evaluate
// classes?
FactoryRegistry.register('factoryInstance', FactoryInstance)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment