Added support for onInit and onSwitchChange event