diff --git a/libs/horizon/src/event/customEvents/CustomBaseEvent.ts b/libs/horizon/src/event/customEvents/CustomBaseEvent.ts index d4595d31..7e73fb16 100644 --- a/libs/horizon/src/event/customEvents/CustomBaseEvent.ts +++ b/libs/horizon/src/event/customEvents/CustomBaseEvent.ts @@ -110,9 +110,12 @@ function extendAttribute(target, source) { 'deltaX', 'deltaY', 'deltaZ', 'deltaMode', ]; - attributes.forEach(attr => { - if (typeof source[attr] !== 'undefined') { - if (typeof source[attr] === 'function') { + const length = attributes.length; + for (let i = 0; i < length; i++) { + const attr = attributes[i]; + const type = source[attr]; + if (type !== 'undefined') { + if (type === 'function') { target[attr] = function() { return source[attr].apply(source, arguments); }; @@ -120,5 +123,5 @@ function extendAttribute(target, source) { target[attr] = source[attr]; } } - }) + } }