separated calling js from delegate method