Sha256: b56f9e3379c8754394d8d75c2db733555ff32627362baecb1ad864a6f521aaf6

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

module Hyperstack
  module Router
    class History
      include Native

      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

6 entries across 6 versions & 1 rubygems

Version Path
hyper-router-1.0.alpha1.5 lib/hyperstack/router/history.rb
hyper-router-1.0.alpha1.4 lib/hyperstack/router/history.rb
hyper-router-1.0.alpha1.3 lib/hyperstack/router/history.rb
hyper-router-1.0.alpha1.2 lib/hyperstack/router/history.rb
hyper-router-1.0.alpha1.1 lib/hyperstack/router/history.rb
hyper-router-1.0.alpha1 lib/hyperstack/router/history.rb