History log of /yui3/src/app/tests/manual/controller.js
Revision Date Author Comments Expand
5125fb9611d90216a17ec67d0bd8a7b17b2fb734 08-Jul-2011 Ryan Grove <ryan@wonko.com>

Queue save() and replace() calls to prevent race conditions. [Fixes #2530506] Making multiple consecutive calls to save() or replace() would result in each call dispatching to the URL of the final call, due to a combination of HTML5 history quirks and a race condition in how dispatching was handled. The fix is to add all save() and replace() calls to a queue and ensure that we don't start processing one until the previous one (if any) has finished, thus guaranteeing that all calls will result in a dispatch to the correct URLs. We also ensure that a save() or replace() call never occurs before window.onload, since this triggers a Chrome bug that would cause a duplicate popstate event for the call that was already handled.

f2a8495d95fb3a18b61cfdd9d24ddbd878eb6773 10-Jun-2011 Ryan Grove <ryan@wonko.com>

Don't dispatch on init by default. I've added a `dispatchOnInit` config property and a `ready` event that fires once the controller is ready to dispatch routes ("ready" means that we've waited long enough to know whether or not the browser has fired a history change event). Setting `dispatchOnInit` to true will cause the controller to dispatch to handle the current route at initialization time if no history change event has occurred by the time the `ready` event fires. This is useful for apps that are rendered entirely client-side, with no server-side route handling.