Svelte · Middle · Question 61 of 75

How do you listen to visibilitychange on document in a component?

Explanation

<svelte:body> similarly handles events like mouseenter on document.body. Svelte removes the listeners on destroy.

Further reading

Problem with a question

Svelte · Middle · question 61

Test yourself

Take the Svelte · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz