Summary
An easy and lazy solution for click-event-binding.
Step 1
Define some actions:
action.add({'my-action': function(){//do something...},
...
})Step 2
Create an element like this:
<buttondata-action="my-action">btn</button><!-- or --><ahref="#" data-action="my-action">link</a><!-- or --><ahref="#my-action" data-action>link</a>
Step 3
You've done everything.
Clicking the element will trigger the action you defined.
Summary
Step 1
Define some actions:
Step 2
Create an element like this:
Step 3
You've done everything.
Clicking the element will trigger the action you defined.