Skip to content

Commit

Permalink
Add timeout to processing Turbo event - needed for Safari #73
Browse files Browse the repository at this point in the history
  • Loading branch information
leonvogt committed Aug 25, 2024
1 parent 7e594db commit 3ca0e1e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,11 @@ const renderDetailPanel = () => {
const listenForEvents = () => {
MONITORING_EVENTS.forEach((eventName) => {
window.addEventListener(eventName, (event) => {
handleMonitoredEvent(eventName, event)
// For some unknown reason, we can't use the event itself in Safari, without loosing the event.detail property.
// The only hacky workaround that seems to work is to use a setTimeout with 0ms delay. (Issue#73
setTimeout(() => {
handleMonitoredEvent(eventName, event)
}, 0)
})
})
}
Expand Down

0 comments on commit 3ca0e1e

Please sign in to comment.