users@javaserverfaces-spec-public.java.net

[jsr372-experts mirror] f:websocket hoisting

From: Rahman USTA <rahman.usta.88_at_gmail.com>
Date: Sat, 4 Feb 2017 15:12:33 +0300

Hello,

I'm trying JSF 2.3's new WebSocket support.

When I declare onmessage function above of <f:websocket declaration, it
finds referenced function. So the following usage works;

<script type="application/javascript">
    function onMessage(message) {
        document.getElementById('holder').innerText = message;
    }
</script>

<f:websocket
        channel="push"
        onmessage="onMessage"/>


But, when I move the script declaration below the <f:websocket, it doesn't
find onMessage function. So the following usage doesn't work;

<f:websocket
        channel="push"
        onmessage="onMessage"/>

<script type="application/javascript">
    function onMessage(message) {
        document.getElementById('holder').innerText = message;
    }
</script>

I think it would be good if the last usage supported.

Thanks.

-- 
Rahman USTA
Istanbul JUG
https://github.com/rahmanusta