MCPcopy Create free account
hub / github.com/FThompson/FormPersistence.js / clearStorage

Function clearStorage

form-persistence.js:269–277  ·  view source on GitHub ↗

* Clears a given form's data from local or session storage. * * @param {HTMLFormElement} form The form to clear stored data for. * @param {Object} options Options object containing any of the following: * * uuid - A unique identifier for this form's storag

(form, options)

Source from the content-addressed store, hash-verified

267 * * useSessionStorage - Use session storage if `true`, local storage if `false`. Default `false`.
268 */
269 function clearStorage(form, options) {
270 let defaults = {
271 uuid: null,
272 useSessionStorage: false
273 }
274 let config = Object.assign({}, defaults, options)
275 let storage = config.useSessionStorage ? sessionStorage : localStorage
276 storage.removeItem(getStorageKey(form, config.uuid))
277 }
278
279 /**
280 * Applies the given values to the given element.

Callers 1

persistFunction · 0.85

Calls 1

getStorageKeyFunction · 0.85

Tested by

no test coverage detected