1

I need to know when the crossrider's extension closes so I can throw some message in the background. It was easy on the other way around

appAPI.ready(function() {

}

This is what I'm using on popup.html to determine if the extension is opened. So what I need is something like appAPI.close(function() {}) but I can't find it on the Crossrider's doc http://docs.crossrider.com/

Dharman
  • 30,962
  • 25
  • 85
  • 135

1 Answers1

0

So if you want to monitor "popup page close" event, just listen to unload event for popup page.

window.addEventListener("unload", function() {
    // Your logic here
}, false);

Please be aware you can't use console.log in the function, since by the time the unload event fires it is already too late. See this post for more details.

Community
  • 1
  • 1
Haibara Ai
  • 10,703
  • 2
  • 31
  • 47