JezK
Edit File: view.js
// Generated by CoffeeScript 2.7.0 (function() { require('./snapshot'); require('./snapshot_renderer'); require('./error_renderer'); Turbolinks.View = class View { constructor(delegate) { this.delegate = delegate; this.htmlElement = document.documentElement; } getRootLocation() { return this.getSnapshot().getRootLocation(); } getElementForAnchor(anchor) { return this.getSnapshot().getElementForAnchor(anchor); } getSnapshot() { return Turbolinks.Snapshot.fromHTMLElement(this.htmlElement); } render({snapshot, error, isPreview}, callback) { this.markAsPreview(isPreview); if (snapshot != null) { return this.renderSnapshot(snapshot, isPreview, callback); } else { return this.renderError(error, callback); } } // Private markAsPreview(isPreview) { if (isPreview) { return this.htmlElement.setAttribute("data-turbolinks-preview", ""); } else { return this.htmlElement.removeAttribute("data-turbolinks-preview"); } } renderSnapshot(snapshot, isPreview, callback) { return Turbolinks.SnapshotRenderer.render(this.delegate, callback, this.getSnapshot(), Turbolinks.Snapshot.wrap(snapshot), isPreview); } renderError(error, callback) { return Turbolinks.ErrorRenderer.render(this.delegate, callback, error); } }; }).call(this);