Add event handling to the snApi object and convert modules