I had to put in place a shim before the import of backbone, to fix this: /** * T5 is nice enough to use Underscore in noConflict() mode, but Backbone expects it to be visible as window._, so we hack that. */ window._ = T5._;
On Mon, Nov 5, 2012 at 11:35 AM, Kristian Marinkovic < [email protected]> wrote: > Hi, > > i need some advice on how to properly integrate backbone.js in my T5 > application. > > Adding backbone.js with the @Import annotation results in an console > error because it can't find the global underscore object _. The reason > for that is the mapping of underscore to the T5 namespace in > t5-core.js. When i tried to replace the core javascript stack i > realized that it was already overridden by tapestry5-jquery. My quick > workaround is to add the assets underscore.js and backbone.js manually > using JavascriptSupport; this way i can control the order and _ is > initialized globally again, but underscore is included twice in my > pages. > > void afterRender() > { > jsSupport.importJavaScriptLibrary(underscore); > jsSupport.importJavaScriptLibrary(backbone); > } > > How could i solve this problem differently? Is anyone using T5 with > backbone already? I'd be interested how the view templates are > handled. > > g, > Kris > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com
