Skip to content

Commit

Permalink
Handle reloading window while ipc polling
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsawicki committed Apr 21, 2016
1 parent fcc3e6a commit a0192dd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/ipc-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,14 @@ exports.listenForEvents = () => {

exports.getEvents = () => {
return Eval.execute(() => {
const events = global.__devtron.events.slice()
global.__devtron.events = []
const events = global.__devtron.events
if (events) global.__devtron.events = []
return events
}).then((events) => {
if (events) return events

// Start listening for events if array is missing meaning
// the window was reloaded
return exports.listenForEvents().then(() => [])
})
}

0 comments on commit a0192dd

Please sign in to comment.