Add JS example for event definition