This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
event-twister with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
Twist events at a dom
Note This library depends on
jQuery and class-component
An event twister is a dom element which has the functionality to "twist" an event which is triggered on the element into the other type of events.
For example an event twister,
<div class="event-twister" twist="click: foo;"></div>, twists the
click events on it into
See the section below for actual usage.
<script src="path/to/jquery.js"></script> <script src="path/to/class-component.js"></script> <script src="path/to/event-twister.js"></script> <div class="event-twister" twist="click: foo; mouseover: bar; mouseout: baz;">...</div>
.event-twister class declares the element is an event twister. The
twist attribute defines what events are "twisted" to other events. In this case,
click event will be twisted to
foo custom event,
bar event and
baz event. The syntax of the
twist attribute is the same as css style properties.
See the DEMO