Skip to content
Open
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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,13 @@ manager.on('event#1 event#2', function (evt, data) {
Note that you can listen to multiple events at once by separating
them either with a space or a comma (or both, I don't care).

You can also separate events in an array.
```javascript
manager.on(['event#1', 'event#2'], function (evt, data) {
// Do something.
});
```

#### `manager.off([type, handler])`

To remove an event handler :
Expand Down
2 changes: 1 addition & 1 deletion example/codepen-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
createNipple('dynamic');

function bindNipple () {
joystick.on('start end', function (evt, data) {
joystick.on(['start', 'end'], function (evt, data) {
dump(evt.type);
debug(data);
}).on('move', function (evt, data) {
Expand Down
2 changes: 1 addition & 1 deletion src/super.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Super () {}
// Basic event system.
Super.prototype.on = function (arg, cb) {
var self = this;
var types = arg.split(/[ ,]+/g);
var types = Array.isArray(arg) ? arg: arg.split(/[ ,]+/g);
var type;
self._handlers_ = self._handlers_ || {};

Expand Down