onHide(action: ()=>void): KEventController
Register an event that runs when tab is hidden.
param
action- The function that is run what the tab is hidden.
// spooky ghost
let ghosty = add([
pos(center()),
sprite("ghosty"),
anchor("center"),
]);
// when switching tabs, this runs
onHide(() => {
destroy(ghosty);
add([
text("There was never aa ghosttttt"),
pos(center()),
anchor("center")
]);
});
returns
The event controller.
since
v3001.0
group
Events