Make JS reloadTypes variable behaves as a singleton

closes #379