Reminds me of GitHub catalyst web component framework (and I think related to stimulusjs?), which has targets & actions. <a href="https://github.com/github/catalyst">https://github.com/github/catalyst</a><p><pre><code> <button data-action="click:hello-world#greet">
</code></pre>
I love the intentionality of this: it makes intent evident. It's also fun & easy to script!