Convert `subscription.coffee` to the js version