Sha256: 90f25ce265ea2203f5b3b9d2d6f055efea1844be7e6378aa8c0585635bcc2715

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module Hyperstack
  module Router
    class History
      include Native::Wrapper

      def initialize(native)
        @native = native
      end

      def to_n
        @native
      end

      def location
        Location.new(`#{@native}.location`)
      end

      def block(message = nil)
        if message
          native_block(message.to_n)
        else
          native_block do |location, action|
            yield Location.new(location), action
          end
        end
      end

      def listen
        native_listen do |location, action|
          yield Location.new(location), action
        end
      end

      alias_native :action
      alias_native :native_block, :block
      alias_native :create_href, :createHref
      alias_native :entries
      alias_native :go
      alias_native :go_back, :goBack
      alias_native :go_forward, :goForward
      alias_native :index
      alias_native :length
      alias_native :native_listen, :listen
      alias_native :push, :push
      alias_native :replace, :replace
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hyper-router-1.0.alpha1.8 lib/hyperstack/router/history.rb
hyper-router-1.0.alpha1.7 lib/hyperstack/router/history.rb
hyper-router-1.0.alpha1.6 lib/hyperstack/router/history.rb