Sha256: c9213d23a0ece0f452a78d81f56c767ca63dcc98d2aea12fe79acdf994cf7526
Contents?: true
Size: 701 Bytes
Versions: 24
Compression:
Stored size: 701 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(volt_app) @volt_app = volt_app 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) @volt_app.url.parse(`document.location.href`) @volt_app.url.update! unless first_call end end end
Version data entries
24 entries across 24 versions & 1 rubygems
Version | Path |
---|---|
volt-0.9.5.pre2 | lib/volt/page/url_tracker.rb |
volt-0.9.5.pre1 | lib/volt/page/url_tracker.rb |
volt-0.9.4 | lib/volt/page/url_tracker.rb |
volt-0.9.4.pre5 | lib/volt/page/url_tracker.rb |