Why: because transitionTo and handleURL are fundamentally different, and you don't want to automatically deserialize everything all at once, so the idea is that routeTo handlers only get contextResolver objects.
- No longer encourage/allow external calls to a Route's
transitionTomethod. - Instead, make use of a new
routeToevent, with the same semantics astransitionTo, only that it's an event that routes can respond to. - ApplicationRoute will have a default
routeTohandler which passes its args to an internaltransitionTo. - URL changes will be converted into a
routeToevent event.
router.send('routeTo', 'posts.show', Post.find(123));Post.find(123)returns anEmber.Deferred, an object with a.thenproperty.- The router sends the
routeToevent up the route hierarchy. - If no one else handles it beforehand, the default
routeTohandler injected intoApplicationRoutewill. This is where we can define default application-wide transitioning behavior.
One major question that remains is: how do we handle promise contexts?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
| <html> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
| <title>~/asd.emblem.html</title> | |
| <meta name="Generator" content="Vim/7.3"> | |
| <meta name="plugin-version" content="vim7.3_v10"> | |
| <meta name="syntax" content="emblem"> | |
| <meta name="settings" content="number_lines,use_css,expand_tabs"> | |
| <style type="text/css"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
| <html> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
| <title>~/borf.rb.html</title> | |
| <meta name="Generator" content="Vim/7.3"> | |
| <meta name="plugin-version" content="vim7.3_v10"> | |
| <meta name="syntax" content="ruby"> | |
| <meta name="settings" content="number_lines,use_css,expand_tabs"> | |
| <style type="text/css"> |
- Backwards-compatibility with existing router/transition behavior.
- All transitions funneled through a
transitionToevent. - Inject default
transitionTohandler into ApplicationRoute events hash, which will call router.js'stransitionTo. - All other external
transitionTo,transitionToRouteAPI will convert totransitionToevent.
- Sound state-machine-based approach to transitions
- Configurable/overridable defaults for handling transitions involving promise-y contexts
- Full backwards compatibility with present API
Event-ize transitionTo PR 2552
transitionTo PR 2552If you've filled out some fields in a navigate elsewhere, either via a back button, URL change, or linkTo transition, there should be a way to intercept that transition and make the user confirm they want to perform the transition.
Use routeTo handler on form route. Bubble the event if user confirms
navigation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try{ | |
| try { | |
| try { } | |
| finally { | |
| alert('inner'); | |
| throw new Error('ERROR INNER'); | |
| } | |
| } | |
| finally { | |
| alert('outer'); |