From d8f6349c31e1f5bbb356bbfca949452b71548bc8 Mon Sep 17 00:00:00 2001 From: * <8> Date: Wed, 26 Jan 2022 14:53:01 +0800 Subject: [PATCH] Match-id-ebfb7eb1a6693fb72c23d8ba7798ee6f1ba9772d --- .../horizon/src/event/customEvents/CustomBaseEvent.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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]; } } - }) + } }