Converted javascript into an AMD module.