Trouble with text inputs and double update roundtrips

How about this?
https://ellie-app.com/bdXzGmL5S6Va1

  • only uses one call to update
  • gets the exact time of the user’s input
  • no problems with the cursor

Instead of using onInput, you useon "input" and provide you own decoder for the event. Events have a timeStamp property that tells you when the event occurred relative to the time origin (in ms). You can pass the time origin into elm via a flag (using performance.timeOrigin) and then use that to get the absolute timestamp for your event in the update function.

1 Like