switch to require js modules and setting up events page