From 68b86286c0d2e955a85c3e569e156f1db4f78e0b Mon Sep 17 00:00:00 2001 From: Blair MacIntyre Date: Fri, 3 Jan 2020 11:07:26 -0500 Subject: [PATCH] fix for iOS bug This is the code that fixes issue #130 --- src/api/XRInputSourceEvent.js | 2 ++ src/api/XRInputSourcesChangeEvent.js | 2 ++ src/api/XRReferenceSpaceEvent.js | 2 ++ src/api/XRSessionEvent.js | 2 ++ 4 files changed, 8 insertions(+) diff --git a/src/api/XRInputSourceEvent.js b/src/api/XRInputSourceEvent.js index f934bd9..da4e462 100644 --- a/src/api/XRInputSourceEvent.js +++ b/src/api/XRInputSourceEvent.js @@ -26,6 +26,8 @@ export default class XRInputSourceEvent extends Event { frame: eventInitDict.frame, inputSource: eventInitDict.inputSource }; + // safari bug: super() seems to return object of type Event, with Event as prototype + Object.setPrototypeOf(this, XRInputSourceEvent.prototype); } /** diff --git a/src/api/XRInputSourcesChangeEvent.js b/src/api/XRInputSourcesChangeEvent.js index a03a65c..f87a3a4 100644 --- a/src/api/XRInputSourcesChangeEvent.js +++ b/src/api/XRInputSourcesChangeEvent.js @@ -27,6 +27,8 @@ export default class XRInputSourcesChangeEvent extends Event { added: eventInitDict.added, removed: eventInitDict.removed }; + // safari bug: super() seems to return object of type Event, with Event as prototype + Object.setPrototypeOf(this, XRInputSourcesChangeEvent.prototype); } /** diff --git a/src/api/XRReferenceSpaceEvent.js b/src/api/XRReferenceSpaceEvent.js index 3d7398b..49905ed 100644 --- a/src/api/XRReferenceSpaceEvent.js +++ b/src/api/XRReferenceSpaceEvent.js @@ -26,6 +26,8 @@ export default class XRReferenceSpaceEvent extends Event { referenceSpace: eventInitDict.referenceSpace, transform: eventInitDict.transform || null }; + // safari bug: super() seems to return object of type Event, with Event as prototype + Object.setPrototypeOf(this, XRReferenceSpaceEvent.prototype); } /** diff --git a/src/api/XRSessionEvent.js b/src/api/XRSessionEvent.js index c093d8b..38d108c 100644 --- a/src/api/XRSessionEvent.js +++ b/src/api/XRSessionEvent.js @@ -25,6 +25,8 @@ export default class XRSessionEvent extends Event { this[PRIVATE] = { session: eventInitDict.session }; + // safari bug: super() seems to return object of type Event, with Event as prototype + Object.setPrototypeOf(this, XRSessionEvent.prototype); } /**