Sha256: bd8086a70dc89d5a4d5ea4971b8b60dc4d05c2c4daf4991dd2af2d0c53fb6e81

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

module Hyperstack
  module Router
    class NoHistoryError < StandardError; end
    def self.included(base)
      base.extend(Hyperstack::Internal::Router::ClassMethods)

      base.include(Hyperstack::Internal::Router::Helpers)

      base.class_eval do

        def history
          self.class.history
        end

        def location
          self.class.location
        end

        after_mount do
          @_react_router_unlisten = history.listen do |location, _action|
            Hyperstack::Internal::State::Mapper.mutated! Hyperstack::Router::Location
          end
        end

        before_unmount do
          @_react_router_unlisten.call if @_react_router_unlisten
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hyper-router-1.0.alpha1.2 lib/hyperstack/router.rb
hyper-router-1.0.alpha1.1 lib/hyperstack/router.rb