PRIVATE
Extends: Ember.Object
Defined in: packages/ember-views/lib/system/event_dispatcher.js:17
Module: ember-views
Ember.EventDispatcher handles delegating browser events to their corresponding Ember.Views. For example, when you click on a view, Ember.EventDispatcher ensures that that view's mouseDown method gets called.
Sets up event listeners for standard browser events.
This will be called after the browser sends a DOMContentReady event. By default, it will set up all of the listeners on the document body. If you would like to register the listeners on a different element, set the event dispatcher's root property.
Object
Registers an event listener on the rootElement. If the given event is triggered, the provided event handler will be triggered on the target view.
If the target view does not implement the event handler, or if the handler returns false, the parent view will be called. The event will continue to bubble to each successive parent view until it reaches the top.
booleanprivate
It enables events to be dispatched to the view's eventManager. When present, this object takes precedence over handling of events on the view itself.
Note that most Ember applications do not use this feature. If your app also does not use it, consider setting this property to false to gain some performance improvement by allowing the EventDispatcher to skip the search for the eventManager on the view tree.
let EventDispatcher = Em.EventDispatcher.extend({
events: {
click : 'click',
focusin : 'focusIn',
focusout : 'focusOut',
change : 'change'
},
canDispatchToEventManager: false
});
container.register('event_dispatcher:main', EventDispatcher);
Default: false
Objectprivate
The set of events names (and associated handler function names) to be setup and dispatched by the EventDispatcher. Modifications to this list can be done at setup time, generally via the Ember.Application.customEvents hash.
To add new events to be listened to:
let App = Ember.Application.create({
customEvents: {
paste: 'paste'
}
});
To prevent default events from being listened to:
let App = Ember.Application.create({
customEvents: {
mouseenter: null,
mouseleave: null
}
});
Objectprivate
Global action id hash.
DOMElementprivate
The root DOM element to which event listeners should be attached. Event listeners will be attached to the document unless this is overridden.
Can be specified as a DOMElement or a selector string.
The default body is a string since this may be evaluated before document.body exists in the DOM.
Default: 'body'
© 2017 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
http://emberjs.com/api/classes/Ember.EventDispatcher.html