Skip to content
This repository has been archived by the owner on May 20, 2022. It is now read-only.

paynecodes/sample-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Sample Code

The backbone folder contains some code I wrote a while back. I'll do my best to provide some context. This application is a Single Page JavaScript application utilizing Backbone, Marionette, RequireJS, among many other libraries like any other application of this scale.

  1. module.js defines the module (actually a sub-module), its' dependencies, routes, a routing API object, and messaging events.

  2. controller.js is pretty simple in this scenario (perhaps I should have picked a more complex controller, but, then again, this should be easy to consume). Basically, it defines a listStructure method on the List.Controller. The details of this method aren't all that important or easy to follow without more context, but basically, I needed to setup a deferred object, and jump to a particular "slide" after that deferred object is resolved.

  3. view.js is quite complex, so I'll briefly explain the basics. A collection is passed to the CompositeView defined as List.StructurePage, and Marionette provides a nice construct for rendering models in an ItemView defined as List.StructureItem. There are a ton of events both emitted and received in this view. Unfortunately, I don't have control over the data coming in from the JSON API, so I've got to do some pretty awkward manipulation with it, and elected to do it in the view here.

  4. entity.js is responsible for returning Models and Collection from the JSON API. Also, I am caching this long-lived data in localStorage, but those implementation details are abstracted in the base collection referenced in the RequireJS block, entities/_base/_collections.

  5. custom_backbone_marionette_transition_region.js and transition_adapter.js are just there, so you can take a look at how I implemented hardware accelereated page transitions between views.

About

Here is a bit of sample code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published