Wire.js backbone plugins

118 views
Skip to first unread message

Guy Nesher

unread,
Oct 14, 2013, 5:41:13 AM10/14/13
to cuj...@googlegroups.com
Hi guys,

I'm using wire.js with backbone.js in my current project and created a couple of helper plugins that might come handy:
bbRouter - allows you to define backbone routes from within wire.js, https://github.com/conversocial/bbRouter
bbEvents - allows you to hook into backbone events from within wire.js https://github.com/gnesher/bbevents

Do let me know if you find them useful, have any ideas on how to improve them.
Also, if you have ideas of additional Backbone.js plugins that might come in handy do let me know.

Guy

Brian Cavalier

unread,
Oct 18, 2013, 9:32:53 PM10/18/13
to cuj...@googlegroups.com
This is awesome, Guy.  Sorry it took me a while to find the time to take a look.  How are they working out in practice?

Guy Nesher

unread,
Oct 21, 2013, 7:19:25 AM10/21/13
to cuj...@googlegroups.com
I've created both plugins just to simplify/make the code more readable.

The routing plugin simply removes some boilerplate/makes the code easier to read. 

I was building a simple email app just to see how wire works and this:

Instead of having a router spec which instantiated a module and connected the different modules I simply added this plugin to the main spec.

router:
        bbRouter:
            routes
:            
               
'':  'js/components/allemail/spec'
               
'archive': 'js/components/archive/spec'
               
'email/:id': 'js/components/singleemail/spec'


It works like a charm in 90% of the cases.

The extra plugin (bbconnect) was used to handle a situation where a route change had to update more than one module

        bbConnect:
           
'route': 'viewModel.changeRoute'


simply allowed my nav bar to keep track of route changes.

I suspect that on really big applications you might need something slightly more robust, and the fact that you can't de-register a router in Backbone means you cant easily use subroutes (which I originally wanted to use)
But it's good enough for small/medium sized CRUD apps and I really don't want to write my own router at the moment :) 
Reply all
Reply to author
Forward
0 new messages