Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event handler execution count for a handler defined for a behavior is shared among all installations of that behavior #527

Open
esbengc opened this issue Mar 27, 2024 · 1 comment

Comments

@esbengc
Copy link

esbengc commented Mar 27, 2024

If a behavior defines an event handler with a dispath count filter, then that filter will track the total number of dispatches across all installations of that behavior, rather than applying to each installation separately.

Example:

<script type="text/hyperscript">
behavior CounterToThree
  on click 1 to 3 increment my textContent
</script>
<button _="install CounterToThree">0</button>
<button _="install CounterToThree">0</button>

Expected behavior: I expect to be able to click each button 3 times after which the two two buttons should display 3 3

Actual behavior: The 2 buttons can be clicked 3 times in total. That is, once they display either 3 0, 2 1, 1 2 or 0 3, neither button will respond to additional clicks.

@WedersonCD
Copy link

To be honest I don't understand why your code didn't works.. but I made a change on it and now works fine:

<script type="text/hyperscript"> behavior CounterToThree on click increment my textContent unless my textContent is 3 </script> <button _="install CounterToThree">0</button> <button _="install CounterToThree">0</button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants