Refactor 'js' module to use classes for different js object types.
Begin preparation for testing of 'js' module.