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