nx.js
Classes

Storage

See

https://developer.mozilla.org/docs/Web/API/Storage

Implements

Indexable

[name: string]: any

Accessors

length

get length(): number

The number of data items stored in the data store.

See

https://developer.mozilla.org/docs/Web/API/Storage/length

Returns

number

Implementation of

globalThis.Storage.length

Methods

clear()

clear(): void

Clears all keys stored in a data store.

Returns

void

Implementation of

globalThis.Storage.clear

See

https://developer.mozilla.org/docs/Web/API/Storage/clear


getItem()

getItem(key): null | string

Get an item from the provided key from the data store.

Parameters

ParameterTypeDescription
keystringThe name of the key you want to retrieve the value of.

Returns

null | string

A string containing the value of the key. If the key does not exist, null is returned.

Implementation of

globalThis.Storage.getItem

See

https://developer.mozilla.org/docs/Web/API/Storage/getItem


key()

key(index): null | string

Retrieves the name of the nth key in the data store. The order of keys is user-agent defined, so you should not rely on it.

Parameters

ParameterTypeDescription
indexnumberThe number of the key you want to get the name of. This is a zero-based index.

Returns

null | string

A string containing the name of the key. If the index does not exist, null is returned.

Implementation of

globalThis.Storage.key

See

https://developer.mozilla.org/docs/Web/API/Storage/key


removeItem()

removeItem(key): void

Removes the provided key from the data store, if it exists.

If there is no item associated with the given key, this method will do nothing.

Parameters

ParameterTypeDescription
keystringThe name of the key you want to remove.

Returns

void

Implementation of

globalThis.Storage.removeItem

See

https://developer.mozilla.org/docs/Web/API/Storage/removeItem


setItem()

setItem(key, value): void

Adds or updates the key to the data store with the provided value.

Parameters

ParameterTypeDescription
keystringThe name of the key you want to create / update.
valuestringThe value you want to give the key you are creating / updating.

Returns

void

Implementation of

globalThis.Storage.setItem

See

https://developer.mozilla.org/docs/Web/API/Storage/setItem

On this page