Quick question:
I'm allowed to (as in "TypeScript allows me to") return a function from the function I declare inside onMount.
The docs does not comment on this (https://docs.solidjs.com/reference/lifecycle/on-mount), so what does it do? When is the returned function run?
Example:
onMount(() => {
const subscriptionID = props.plexer.subscribe(PLAYER_MOVE_EVENT, (event) => {
if (
event.playerID === props.backend.localPlayer.id
&& event.locationID === props.colonyLocation.locationID
) {
setUserIsHere(true);
}
});
return () => {
props.plexer.unsubscribe(subscriptionID);
}
})