Search code examples
javascriptbackbone.jsmarionetteeventaggregator

Backbone.Wreqr vs Javascript Object


What are the main benefits backbone.wreqr has over a js object, both cases having access to marionette's Event aggregator.
Wouldn't assigning/calling methods from an object work the same way as Commands / RequestResponse. To me i see no need to implement this other than giving semantic/readability a +1.

https://github.com/marionettejs/backbone.wreqr
Can someone please enlighten me, this is my first backbone (and modular) application.


Solution

  • The benefits are:

    • event and command handling is optional and you don't need to check manually yourself for undefineds
    • optionally multiple handlers for each event
    • lazy execution of commands (fire event first, register command later and it will immediately be executed)
    • you can define the scope of execution w/o using any additional methods like $.proxy, ...