Guillaume
Guillaume

Reputation: 4361

How to trigger code when a popover is hidden in a Safari extension?

In a Safari extension, is there a way to trigger some code when a popover is hidden? There is the popover event when the popover is first shown, but I haven't found the opposite, when the popover is hidden.

I use <progress> elements in the popover, and they seem to be very CPU hungry, so I would like to disable them when the popover is not shown.

Upvotes: 0

Views: 381

Answers (1)

chulster
chulster

Reputation: 2829

From within the popover,

window.onblur = function (e) {
    // do something
};

should do the trick.

Upvotes: 2

Related Questions