Sha256: 2c5b67931e2f9077ef572680045e74697defcd02f09b0d58bdae06ad3e9e4451
Contents?: true
Size: 681 Bytes
Versions: 45
Compression:
Stored size: 681 Bytes
Contents
module Volt # The URLTracker is responsible for updating the url when # a param changes, or updating the url model/params when # the browser url changes. class UrlTracker def initialize(page) @page = page if Volt.client? that = self # Setup popstate on the dom ready event. Prevents an extra # popstate trigger ` window.addEventListener("popstate", function(e) { that.$url_updated(); return true; }); ` end end def url_updated(first_call = false) @page.url.parse(`document.location.href`) @page.url.update! unless first_call end end end
Version data entries
45 entries across 45 versions & 1 rubygems