Created
October 4, 2015 07:03
-
-
Save jgaskins/f09c3aa980367ede72e4 to your computer and use it in GitHub Desktop.
Brainstorm for Clearwater routing callbacks
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
class Router | |
def navigate_to path | |
current_targets = targets_for_path(current_path) | |
new_targets = targets_for_path(path) | |
(current_targets - new_targets).each do |from_target| | |
if from_target.respond_to?(:will_transition_from) | |
from_target.will_transition_from | |
end | |
end | |
(new_targets - current_targets).each do |to_target| | |
if to_target.respond_to?(:will_transition_to) | |
to_target.will_transition_to | |
end | |
end | |
# do whatever it does currently | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment