I'd say to move code to a helper javascript once it is used by multiple views or becomes so complex that it clutters the file too much.