Module: Hyperloop::Router::Base
- Defined in:
- lib/hyperloop/router/base.rb
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hyperloop/router/base.rb', line 4 def self.included(base) base.extend(HyperRouter::ClassMethods) base.include(HyperRouter::InstanceMethods) base.include(HyperRouter::ComponentMethods) base.class_eval do after_mount do @_react_router_unlisten = history.listen do |location, _action| React::State.set_state(HyperRouter, :location, location) end end before_unmount do @_react_router_unlisten.call if @_react_router_unlisten end end end |