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

Fixed component.trigger doesn't pass event object issue #1298 #1310

Merged
merged 2 commits into from
Jul 28, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/js/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,13 +563,15 @@ vjs.Component.prototype.one = function(type, fn) {
* Trigger an event on an element
*
* myComponent.trigger('eventName');
* myComponent.trigger({'type':'eventName'});
*
* @param {String} type The event type to trigger, e.g. 'click'
* @param {Event|Object} event The event object to be passed to the listener
* @param {Event|Object|String} event either a string (the event type)
* to trigger or an event object
* with a type attribute.
* @return {vjs.Component} self
*/
vjs.Component.prototype.trigger = function(type, event){
vjs.trigger(this.el_, type, event);
vjs.Component.prototype.trigger = function(event){
vjs.trigger(this.el_, event);
return this;
};

Expand Down
6 changes: 4 additions & 2 deletions src/js/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,10 @@ vjs.fixEvent = function(event) {

/**
* Trigger an event for an element
* @param {Element|Object} elem Element to trigger an event on
* @param {String} event Type of event to trigger
* @param {Element|Object} elem Element to trigger an event on
* @param {Event|Object|String} event either a string (the event type)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I had to change these comments to be single-line otherwise the docs parser wasn't picking up anything but the first line

* to trigger or an event object with a
* type attribute.
* @private
*/
vjs.trigger = function(elem, event) {
Expand Down