How to read the event data from the dynamic events

I am using a div which has a dynamic event “touchStart”. And I have connected a js function to it. In this function, it is necessary that I read the event data to get the data event.changedTouches.

How can I get the event data ?

The event data can be found in the data picker:

But this $event cannot be found in the flow editor.

Sorry - can you please explain this more detailed? What and how are you doing, maybe show a few screenshots.

I cannot see the $event value, while using the flow editor method.

Is that an inline flow and not a page flow?
How do you need to pass the event value to your function?

It’s almost never a great idea to use inline flows. Better create a page flow, add a param to it and bind it to the function. Then on touch event call the page flow and pass the event data to the flow parameter.

I tried your method, now the event is passed to the js function. But the value is empty. $event = {}

Are there any error messages in the browser console?

No error messages

What is your flow code? And the touch event calling the flow code as well?

<script is="dmx-flow" id="flow1" type="text/dmx-flow">{

    meta: {

      $param: [

        {type: "text", name: "event"}

      ]

    },

    exec: {

      steps: {

        runJS: {

          function: "test",

          args: ["{{$param.event}}"],

          name: "test"

        }

      }

    }

  }</script>

Event code

<div class="card mt-3 p-3 col d-flex justify-content-between flex-row align-items-center notification-card" dmx-bind:id="notfication_{{id}}" dmx-bind:data-index="$index" dmx-bind:data-id="id" dmx-on:touchstart="flow1.run({event: $event})">

Script

        function test(eve) {

            console.log(eve)

        }

But what are you trying to do with this exactly? Which part of the event data do you want to use and why not pass it then?

I want the changesTouches value from the event. But when I passed that value as $event[‘changedTouches’] it was undefined. So I passed the entire event value, which was empty.

Maybe @patrick can check this.

Seems that the touch event data wasn’t passed correctly.

Here the latest App Connect beta code where I fixed it.
dmxAppConnect.zip (26.1 KB)

It worked, thank you.

Fix is included in Wappler 4.8.0