Create custom events for javascript