add “onTrigger” function