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

Allow instanceInitializers to set customEvents. #12057

Merged
merged 1 commit into from
Aug 12, 2015

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Aug 11, 2015

Instance initializers were previously not able to affect the customEvents that will be provided to the EventDispatcher. This is most helpful when you are receiving configuration that is registered as in an initiailzer.

The fix here is to run instance initializers before the event dispatcher is setup, so that they can augment the customEvents hash.

Related to #12056.


Please note this has not worked previously (though from the look of the code, it was intended to), so it is not a [BUGFIX release] candidate.

Instance initializers were previously not able to affect the
`customEvents` that will be provided to the `EventDispatcher`. This is
most helpful when you are receiving configuration that is registered as
in an initiailzer.

The fix here is to run instance initializers before the event dispatcher
is setup, so that they can augment the `customEvents` hash.
@tomdale
Copy link
Member

tomdale commented Aug 12, 2015

👍 This looks good to me. As part of our efforts of not landing new features without docs or guides, we should definitely include this—but I'm not sure exactly where in the docs it should go. @michaelrkn @locks @trek, any ideas?

@tomdale
Copy link
Member

tomdale commented Aug 12, 2015

FWIW, the use case of wanting to change custom events per instance is going to be exceedingly rare. Remember, instances are per-run, which usually means you need special configuration for the current user, for example. The notion of "which events does the DOM generate?" tends to be application-specific, not instance-specific, so customEvents should usually be set there. That being said, given that EventDispatchers are per-instance, I don't see any problem in making it configurable in an instance as there may be some use cases I can't think of off the top of my head.

@rwjblue
Copy link
Member Author

rwjblue commented Aug 12, 2015

There are existing API docs for ApplicationInstance#customEvents that were added when ApplicationInstance was created (which is why I thought this was supposed to already work).

@michaelrkn
Copy link
Contributor

the use case of wanting to change custom events per instance is going to be exceedingly rare

Then it doesn't belong in the Guides, I don't think.

@tomdale
Copy link
Member

tomdale commented Aug 12, 2015

👍 I'm happy with keeping this feature in the API docs. Maybe someday we can have a kickass 👊 guide for writing addons… but for now, let's focus on apps.

rwjblue added a commit that referenced this pull request Aug 12, 2015
…vents

Allow instanceInitializers to set `customEvents`.
@rwjblue rwjblue merged commit c490566 into emberjs:master Aug 12, 2015
@rwjblue rwjblue deleted the instance-initializers-custom-events branch August 12, 2015 00: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.

3 participants