Javascript variable declared as code and reuse
问题 I have a jquery enabled javascript app that has a variable that is declared as a substantial hunk of code. var Listings = Spine.Controller.sub({ TPL: Handlebars.compile( $( '#entry-template' ).html() ), events: //stuff init: function() //stuff //a whole bunch of functions }); I want to pull this hunk of code into a separate file (as it is about 300 lines long) and load it with jquery. However more importantly, I want to be able to use this code for two variables without resorting to copy