Skip to content

Latest commit

 

History

History
50 lines (32 loc) · 1.84 KB

drive.md

File metadata and controls

50 lines (32 loc) · 1.84 KB
permalink order description
/reference/drive.html
1
A reference of everything you can do with Turbo Drive.

Drive

Turbo.visit

Turbo.visit(location)
Turbo.visit(location, { action: action })

Performs an Application Visit to the given location (a string containing a URL or path) with the specified action (a string, either "advance" or "replace").

If location is a cross-origin URL, or falls outside of the specified root (see Setting a Root Location), Turbo performs a full page load by setting window.location.

If action is unspecified, Turbo Drive assumes a value of "advance".

Before performing the visit, Turbo Drive fires a turbo:before-visit event on document. Your application can listen for this event and cancel the visit with event.preventDefault() (see Canceling Visits Before They Start).

Turbo.cache.clear

Turbo.cache.clear()

Removes all entries from the Turbo Drive page cache. Call this when state has changed on the server that may affect cached pages.

Note: This function was previously exposed as Turbo.clearCache(). The top-level function was deprecated in favor of the new Turbo.cache.clear() function.

Turbo.setProgressBarDelay

Turbo.setProgressBarDelay(delayInMilliseconds)

Sets the delay after which the progress bar will appear during navigation, in milliseconds. The progress bar appears after 500ms by default.

Note that this method has no effect when used with the iOS or Android adapters.

Turbo.session.drive

Turbo.session.drive = false

Turns Turbo Drive off by default. You must now opt-in to Turbo Drive on a per-link and per-form basis using data-turbo="true".