Hello,
I want to find out, what resolution is the user use on client side. Therefore I add following code to the app.js:
let Hooks = {}
Hooks.ScreenInfo = {
mounted() {
console.log("Hello I was called from the hook");
//this.pushEvent({ screenX: window.innerWidth, screenY: window.innerHeight });
}
}
...
let liveSocket = new LiveSocket("/live", Socket, {hooks: Hooks, params: {_csrf_token: csrfToken}})
In the index.html.heex I add an element:
<div id="info" phx-hook="ScreenInfo" />
My problem is, the mounted() - Function is never called. But why? Where is my mistake?
regards,
Sven