simplify JS bridge code to be 3.6 compat