Added support for onInit and onSwitchChange event

#308 fixed