Custom event implementation use plain javascript