Sha256: c4ebfa8387e94c461d45fc82751c735ac7507086b85149e516379ed2b9a5e5e1
Contents?: true
Size: 1.75 KB
Versions: 8
Compression:
Stored size: 1.75 KB
Contents
<h1>Luca.Application</h1> <p>A large single-page app generally needs some sort of globally available state tracking object, as well as something which acts as a single entry point into the application, and some sort of gateway to important objects. </p> <p>Luca.Application is a type of Viewport class which handles things such as: </p> <ul> <li>collection manager ( manages your collections for you ) </li> <li>socket manager ( relays websocket events as Backbone.Events )</li> <li>url fragment router (<code>Backbone.Router</code>)</li> <li>global attributes and change event bindings</li> <li>page controller ( displays a unique page of the application) </li> <li>active view, active sub view helpers</li> </ul> <p>The Luca.Application stores its state in a <code>Backbone.Model</code>, which means you can <code>get()</code> and <code>set()</code> attributes directly on the application, as well as bind to change events on the application itself, and expect the same API you would from a normal model. </p> <p>The ability to treat the Luca.Application instance as both a view, and a model allows for some clean patterns. Your views can declaratively list its dependency on the global application state attributes. </p> <pre><code class="lang-coffeescript"> _.def("MyView").extends("Luca.View").with name: "my_view" applicationEvents: "change:status" : "onStatusChange" onStatusChange: (app, currentStatus)-> if currentStatus is "inactive" @markInactive() markInactive: ()-> # mark this view inactive if the application # goes into inactive status app = Luca.getApplication() # this will cause the view named 'my_view' to # to fire its markInactive() method app.set("status", "inactive")</code></pre>
Version data entries
8 entries across 8 versions & 1 rubygems