Sha256: 1496f6305e356245b26489829bb6959fbcc0e106fbfaacfaa20c859821359a71

Contents?: true

Size: 610 Bytes

Versions: 6

Compression:

Stored size: 610 Bytes

Contents

module Hyperloop
  class Router
    module Base
      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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hyper-router-0.99.6 lib/hyperloop/router/base.rb
hyper-router-0.99.5 lib/hyperloop/router/base.rb
hyper-router-0.99.4 lib/hyperloop/router/base.rb
hyper-router-0.99.3 lib/hyperloop/router/base.rb
hyper-router-0.99.2 lib/hyperloop/router/base.rb
hyper-router-0.99.1 lib/hyperloop/router/base.rb