Removes all key/values pair on the local persistant storage of the user's browser. Defaults to local storage, which is saved across browser sessions. Specify type: 'session'
if session storage is desired.
Data stored in either local or session storage is specific to the protocol of the page.
cable_ready["MyChannel"].clear_storage(type: "session" # local storage vs session storage, defaults to local)
cable-ready:before-clear-storage
cable-ready:after-clear-storage
Add an entry to the browser's session history stack.
This is similar to setting window.location = "#foo"
in that both will also create and activate another history entry associated with the current document. The new URL can be any URL in the same origin as the current URL.
You can associate arbitrary data with your new history entry by passing a Hash to the optional state
parameter.
cable_ready["MyChannel"].push_state(url: "/", # required - URL Stringtitle: "Home", # optional String, default to ""state: {} # optional Hash, defaults to {})
Note that push_state
never causes a hashchange
event to be fired, even if the new URL differs from the old URL only in its hash.
cable-ready:before-push-state
cable-ready:after-push-state
Remove a key/value pair on the local persistant storage of the user's browser. Defaults to local storage, which is saved across browser sessions. Specify type: 'session'
if session storage is desired.
Data stored in either local or session storage is specific to the protocol of the page. Integer keys are automatically converted to strings.
cable_ready["MyChannel"].remove_storage_item(key: "string", # requiredtype: "session" # local storage vs session storage, defaults to local)
cable-ready:before-remove-storage-item
cable-ready:after-remove-storage-item
Writes a cookie to the document cookie store.
cable_ready["MyChannel"].set_cookie(cookie: "string" # required - "example=value; path=/; expires=Sat, 07 Mar 2020 16:19:19 GMT")
Note that you can only set/update a single cookie at a time using this method.
cable-ready:before-set-cookie
cable-ready:after-set-cookie
Set focus on the specified element, if it can be focused. The focused element is the element which will receive keyboard and similar events by default.
cable_ready["MyChannel"].set_focus(selector: "string" # required - string containing a CSS selector or XPath expression)
cable-ready:before-set-focus
cable-ready:after-set-focus
Create or update a key/value pair on the local persistant storage of the user's browser. Defaults to local storage, which is saved across browser sessions. Specify type: 'session'
if session storage is desired.
Data stored in either local or session storage is specific to the protocol of the page. Integer keys are automatically converted to strings.
cable_ready["MyChannel"].set_storage_item(key: "string", # requiredvalue: "string", # requiredtype: "session" # local storage vs session storage, defaults to local)
cable-ready:before-set-storage-item
cable-ready:after-set-storage-item