JezK
Edit File: history.js
// Generated by CoffeeScript 2.7.0 (function() { Turbolinks.History = class History { constructor(delegate) { // Event handlers this.onPopState = this.onPopState.bind(this); this.onPageLoad = this.onPageLoad.bind(this); this.delegate = delegate; } start() { if (!this.started) { addEventListener("popstate", this.onPopState, false); addEventListener("load", this.onPageLoad, false); return this.started = true; } } stop() { if (this.started) { removeEventListener("popstate", this.onPopState, false); removeEventListener("load", this.onPageLoad, false); return this.started = false; } } push(location, restorationIdentifier) { location = Turbolinks.Location.wrap(location); return this.update("push", location, restorationIdentifier); } replace(location, restorationIdentifier) { location = Turbolinks.Location.wrap(location); return this.update("replace", location, restorationIdentifier); } onPopState(event) { var location, ref, restorationIdentifier, turbolinks; if (this.shouldHandlePopState()) { if (turbolinks = (ref = event.state) != null ? ref.turbolinks : void 0) { location = Turbolinks.Location.wrap(window.location); restorationIdentifier = turbolinks.restorationIdentifier; return this.delegate.historyPoppedToLocationWithRestorationIdentifier(location, restorationIdentifier); } } } onPageLoad(event) { return Turbolinks.defer(() => { return this.pageLoaded = true; }); } // Private shouldHandlePopState() { // Safari dispatches a popstate event after window's load event, ignore it return this.pageIsLoaded(); } pageIsLoaded() { return this.pageLoaded || document.readyState === "complete"; } update(method, location, restorationIdentifier) { var state; state = { turbolinks: {restorationIdentifier} }; return history[method + "State"](state, null, location); } }; }).call(this);