Don't bubble by default
parent
9a204b3d8f
commit
6b3e550a48
|
@ -8,12 +8,12 @@ var H5P = H5P || {};
|
|||
H5P.Event = function(type, data, extras) {
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
var bubbles = true;
|
||||
var bubbles = false;
|
||||
if (extras === undefined) {
|
||||
extras = {};
|
||||
}
|
||||
if (extras.bubbles === false) {
|
||||
bubbles = false;
|
||||
if (extras.bubbles === true) {
|
||||
bubbles = true;
|
||||
}
|
||||
this.preventBubbling = function() {
|
||||
bubbles = false;
|
||||
|
@ -161,6 +161,7 @@ H5P.EventDispatcher = (function () {
|
|||
for (var i = 0; i < triggers[event.type].length; i++) {
|
||||
triggers[event.type][i].listener.call(triggers[event.type][i].thisArg, event);
|
||||
}
|
||||
// Bubble
|
||||
if (event.getBubbles() && self.parent instanceof H5P.EventDispatcher && typeof self.parent.trigger === 'function') {
|
||||
self.parent.trigger(event);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue