Sha256: 2ab4d79458ce017f7c2d2cdbd491f2bbf2cbbf54cc9e0e1414d66d2430d1255b

Contents?: true

Size: 552 Bytes

Versions: 6

Compression:

Stored size: 552 Bytes

Contents

module Inesita
  module Browser
    module_function

    Location = Document.JS[:location]
    History = Window.JS[:history]

    def path
      Location.JS[:pathname]
    end

    def query
      Location.JS[:search]
    end

    def decode_uri_component(value)
      JS.decodeURIComponent(value)
    end

    def push_state(path)
      History.JS.pushState({}, nil, path)
    end

    def on_pop_state(&block)
      Window.JS[:onpopstate] = block
    end

    def hash_change(&block)
      AddEventListener.call(:hashchange, block)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
inesita-router-0.4.0.pre.2 opal/inesita-router/browser.rb
inesita-router-0.4.0.pre.1 opal/inesita-router/browser.rb
inesita-router-0.3.0 opal/inesita-router/browser.rb
inesita-router-0.2.1 opal/inesita-router/browser.rb
inesita-router-0.2.0 opal/inesita-router/browser.rb
inesita-router-0.1.0 opal/inesita-router/browser.rb