You can use any of the Backbone components in any way you see fit, but it's up to you write the wiring code. A framework wires your code together and calls it for you.A library is a set of functions and objects which you make use of in your code.The Backbone Router uses JavaScript pushstate to change the URL in the address bar, allowing you to create an entire website clientside without hitting the server. If you tag a new shark, you might add it to the collection.Ĭollections can also fire events. If you have 100 sharks, you would store those in a collection. CollectionsĪ Backbone collection is an array of models. Views can listen to model events and redraw themselves when the model they are attached to changes. Your page will be built up of one or more views. A view might be a form, or a map of sharks in the sea. ViewsĪ view in Backbone is a region on the page into which Backbone will output some data. If your shark eats a swimmer and gains 10 notoriety points, it will fire an event to that effect. If you have an app for tracking sharks in the ocean, you might have a Shark model which would store the location and name of a shark. The view works a little like a controller. Unlike other JavaScript frameworks, there are no controllers. Architectureīackbone provides you with a Model View (MV) architecture. Your server should ideally expose a restful JSON API, but this is not a requirement.īackbone engages in no magic, is very readable, and doesn't try to do too much for you. It's purely clientside, and says very little about your server. You can use it to enhance your existing site, to add interactivity to a form for example, or you can go all out and create a single page app (SPA), where the entire site is generated clientside using JavaScript.īackbone comes packaged as a single JavaScript file which you link in the header of your page. It's a sensibly put together library full of tools to help you organise your web application, a toolkit for tidy JavaScript. It's the progenitor of frameworks like Ember, Angular, even Meteor. Backbone is a the grand-daddy of all the JavaScript MVC frameworks.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |