Only registering js when needed