We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8f3c569 commit 5cfdb52Copy full SHA for 5cfdb52
src/howler.core.js
@@ -1548,10 +1548,17 @@
1548
var events = self['_on' + event];
1549
var i = 0;
1550
1551
- if (fn) {
+ // Allow passing just an event and ID.
1552
+ if (typeof fn === 'number') {
1553
+ id = fn;
1554
+ fn = null;
1555
+ }
1556
+
1557
+ if (fn || id) {
1558
// Loop through event store and remove the passed function.
1559
for (i=0; i<events.length; i++) {
- if (fn === events[i].fn && id === events[i].id) {
1560
+ var isId = (id === events[i].id);
1561
+ if (fn === events[i].fn && isId || !fn && isId) {
1562
events.splice(i, 1);
1563
break;
1564
}
0 commit comments