[XML] Modify events API #76

Merged
thesabinelim merged 1 commits from xml-events-api into master 2023-05-15 02:44:38 +08:00
thesabinelim commented 2023-05-15 02:33:30 +08:00 (Migrated from github.com)

Events are now props (accepting a function) rather than their own separate tags. For example:

<script>
  local basalt = require("basalt")
  getTimesClicked, setTimesClicked = basalt.reactive(0)
  onClick = function()
    setTimesClicked(getTimesClicked() + 1)
  end
</script>

<button text={"Times clicked: " .. getTimesClicked()} onClick={onClick} />
Events are now props (accepting a function) rather than their own separate tags. For example: ```xml <script> local basalt = require("basalt") getTimesClicked, setTimesClicked = basalt.reactive(0) onClick = function() setTimesClicked(getTimesClicked() + 1) end </script> <button text={"Times clicked: " .. getTimesClicked()} onClick={onClick} /> ```
Sign in to join this conversation.
No description provided.