Revert "Revert "Js decoupling""

This reverts commit baa4fd26f95ebbf0e47e9632abdf0370c28ec839.