Sha256: 0c0a7606e76a49006d8e7561ec25ff2f91657abed9c0dfe494ab36869748b27b

Contents?: true

Size: 853 Bytes

Versions: 6

Compression:

Stored size: 853 Bytes

Contents

module Hyperstack
  module Internal
    module Router
      module ClassMethods
        def history(*args)
          if args.count.positive?
            @__history_type = args.first
          elsif @__history_type
            @__history ||= send(:"#{@__history_type}_history")
          end
        end

        def location
          Hyperstack::Router::Location.new(`#{history.to_n}.location`)
        end

        private

        def browser_history
          @__browser_history ||= React::Router::History.current.create_browser_history
        end

        def hash_history(*args)
          @__hash_history ||= React::Router::History.current.create_hash_history(*args)
        end

        def memory_history(*args)
          @__memory_history ||= React::Router::History.current.create_memory_history(*args)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hyper-router-1.0.alpha1.8 lib/hyperstack/internal/router/class_methods.rb
hyper-router-1.0.alpha1.7 lib/hyperstack/internal/router/class_methods.rb
hyper-router-1.0.alpha1.6 lib/hyperstack/internal/router/class_methods.rb
hyper-router-1.0.alpha1.5 lib/hyperstack/internal/router/class_methods.rb
hyper-router-1.0.alpha1.4 lib/hyperstack/internal/router/class_methods.rb
hyper-router-1.0.alpha1.3 lib/hyperstack/internal/router/class_methods.rb