#In the context of SolidStart, does onMount and onCleanup only run on the client?

2 messages · Page 1 of 1 (latest)

quick gale
#

I'm using SolidStart and am looking for a way to just run a window event listener on the client. I need to add it on mount and remove it on cleanup.

In the context of SolidStart, does onMount and onCleanup only run on the client? If not, what's the recommended way to handle what I'm trying to accomplish?

Thanks!

stuck sorrel
#

I know its not exactly an answer to your question, but solid-primitives/event-listener have this functionality written for easy reactive listening on the window. Here is the repo: https://github.com/solidjs-community/solid-primitives/tree/main/packages/event-listener#windoweventlistener

GitHub

A library of high-quality primitives that extend SolidJS reactivity. - solid-primitives/packages/event-listener at main · solidjs-community/solid-primitives