-
Notifications
You must be signed in to change notification settings - Fork 12
adstream.navigator
The adstream.navigator
facility was created in order to streamline the flow within complex one-page Web applications. It was observed that, with UI functionality incrementally increasing, such applications tend to evolve into a collection of largely independent views with their own (but overlapping) data dependencies and diverse means of navigation between them. In short, a one-page app starts to resemble a Web site with multiple linked pages! Instead of fighting this tendency, we have embraced it and created a library providing a declarative “site map” for a page that loads necessary objects via adstream.data API and renders desired CHT templates into appropriate places in the document upon detecting a change in the hash of the document URL.
In order to use this library, associate an adstream.navigator.Controller
object with a top-level element in your application: in most cases, it makes sense to associate it directly with the document body. The controller listens to hash change events published by the dojo.hash() module. Upon this event, controller parses the new hash against a global map of hash patterns that your application’s modules populate at initialization time. From this map it selects a chain of operations — data requests, function calls, template renderings etc. — and executes it, providing object IDs and parameters extracted from the hash to all functions and templates executed as part of the chain.
See the API reference for the detailed information on the use of this facility.