Skip to content

Commit

Permalink
fix multi-events
Browse files Browse the repository at this point in the history
  • Loading branch information
Diokuz committed Jan 29, 2016
1 parent a0eb4c7 commit c58bad8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-baron",
"main": "index.js",
"version": "0.6.2",
"version": "0.6.3",
"homepage": "https://github.com/Diokuz/react-baron",
"authors": [
"Diokuz <diokuz@gmail.com>"
Expand Down
16 changes: 12 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@ function getDOMNode(ref) {
return ref;
};

function on(eventName, handler) {
this[0].addEventListener(eventName, handler);
function on(eventNames, handler) {
eventNames = eventNames.split(' ');

eventNames.forEach(function(eventName) {
this[0].addEventListener(eventName, handler);
}, this);
}

function off(eventName, handler) {
this[0].removeEventListener(eventName, handler);
function off(eventNames, handler) {
eventNames = eventNames.split(' ');

eventNames.forEach(function(eventName) {
this[0].removeEventListener(eventName, handler);
}, this);
}

function addClass(cls) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-baron",
"version": "0.6.2",
"version": "0.6.3",
"description": "React component for baron scrollbar library",
"main": "index.js",
"homepage": "https://github.com/Diokuz/react-baron",
Expand Down

0 comments on commit c58bad8

Please sign in to comment.