A function to define javascript modules.