Update javascript insertion code to support multi-arg callbacks