README.md revision 2e9fb10aede0180d138ecc225730bd384520183d
2e9fb10aede0180d138ecc225730bd384520183dRyan GroveApp Framework
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove=============
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan GroveThe app framework provides simple MVC-like building blocks (models, model lists,
2e9fb10aede0180d138ecc225730bd384520183dRyan Groveviews, and controllers) for writing single-page JavaScript applications.
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan GroveThese building blocks can be used together or separately to create apps ranging
2e9fb10aede0180d138ecc225730bd384520183dRyan Grovein complexity from simple non-interactive views to rich, multiple-view apps with
2e9fb10aede0180d138ecc225730bd384520183dRyan Grovedata binding and full client-server synchronization.
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan GroveIf you've used DocumentCloud's excellent Backbone.js framework, many of the
2e9fb10aede0180d138ecc225730bd384520183dRyan Groveclasses and APIs provided by the app framework will look familiar to you. There
2e9fb10aede0180d138ecc225730bd384520183dRyan Groveare important differences, though, and the YUI app framework takes full
2e9fb10aede0180d138ecc225730bd384520183dRyan Groveadvantage of YUI's powerful component infrastructure under the hood.
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
68be53eabcd12a9495f65bf15eb9429441154511Ryan GroveBuilding Blocks
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove---------------
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
68be53eabcd12a9495f65bf15eb9429441154511Ryan GroveThe app framework provides the following classes, which can be mixed and matched
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grovein virtually any combination to meet your needs. For simple apps, you may find
2e9fb10aede0180d138ecc225730bd384520183dRyan Grovethat you only need a `View`, or perhaps a `View` and a `Model`. For complex
2e9fb10aede0180d138ecc225730bd384520183dRyan Groveapps, you may want to use the full stack. It's entirely up to you.
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
44c5bf47bb4c5ef44563f475b8bf2f26f48825f0Ryan GroveThe `Model` class provides an attribute-based data model with APIs for getting,
2e9fb10aede0180d138ecc225730bd384520183dRyan Grovesetting, validating, and syncing attribute values to a persistence layer or
2e9fb10aede0180d138ecc225730bd384520183dRyan Groveserver, as well as events for being notified of model changes.
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
68be53eabcd12a9495f65bf15eb9429441154511Ryan GroveThe `ModelList` class can contain an ordered list of `Model` instances (for
68be53eabcd12a9495f65bf15eb9429441154511Ryan Groveexample, todo items in a todo list). It provides a convenient API for working
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grovewith a list of models and for adding to, removing from, and sorting the list.
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
68be53eabcd12a9495f65bf15eb9429441154511Ryan GroveFinally, the `View` class represents a logical piece of an application's user
68be53eabcd12a9495f65bf15eb9429441154511Ryan Groveinterface, and is responsible for rendering content. A view instance can be
68be53eabcd12a9495f65bf15eb9429441154511Ryan Groveassociated with a particular model instance to allow for refreshing whenever
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grovethe model changes. Views may also be nested if desired, or even used as
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grovestandalone components with no model associations.
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan GroveNot Yet Implemented
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove-------------------
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan GroveThe `Controller` class (coming in YUI 3.4.0 PR2) will provide URL-based routing
2e9fb10aede0180d138ecc225730bd384520183dRyan Groveusing HTML5 `pushState()` or the location hash, making it easy to wire up route
2e9fb10aede0180d138ecc225730bd384520183dRyan Grovehandlers for different application states while providing full back/forward
2e9fb10aede0180d138ecc225730bd384520183dRyan Grovenavigation support and bookmarkable, shareable URLs.
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove
68be53eabcd12a9495f65bf15eb9429441154511Ryan GroveModules
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove-------
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove* `app`: Rollup module that includes all of the following modules. Use this
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove module when you plan to use the full app framework stack.
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove* `controller`: Provides the `Y.Controller` class (coming in YUI 3.4.0 PR2).
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove* `model`: Provides the `Y.Model` class.
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove* `model-list`: Provides the `Y.ModelList` class.
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove* `view`: Provides the `Y.View` class.
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan GroveExamples
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove--------
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan GroveSee `tests/manual/todo.html` and the corresponding `todo.js` file for an
2e9fb10aede0180d138ecc225730bd384520183dRyan Groveunskinned but functional example of a simple todo list app built using `Model`,
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove`ModelList`, and `View`.
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan GroveEnhanced examples and full documentation will be provided in future preview
2e9fb10aede0180d138ecc225730bd384520183dRyan Grovereleases of YUI 3.4.0.
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove
68be53eabcd12a9495f65bf15eb9429441154511Ryan GroveChange History
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove--------------
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove### 3.4.0 PR1
68be53eabcd12a9495f65bf15eb9429441154511Ryan Grove
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove* Initial preview release. API is subject to change before final release, so use
2e9fb10aede0180d138ecc225730bd384520183dRyan Grove with caution.