| FoxitPDFSDKforWeb v11.0.6 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
LocalStorageDriver Class Reference
PDFViewCtrl » storage

The storage driver solution based on localStorage. More...

Inheritance diagram for LocalStorageDriver:

## Public Member Functions
async | get< T > (context:StorageContext, key:string)
| Retrieves the value associated with the specified key in the storage space. T The type of the value to retrieve. More...
| onChange< T > (callback:(event:StorageDriverChangeEvent< T >)=> void)
| Subscribes to storage change events and invokes the callback function whenever a change occurs. T - The type of value. More...
async | remove (context:StorageContext, key:string)
| Removes the value associated with the specified key in the storage space. More...
async | removeAll (context:StorageContext)
| Removes all data stored in the specified storage space. More...
async | set< T > (context:StorageContext, key:string, value:T)
| Store/Overwrite the value associated with the specified key in the storage space. T - The type of the value to store. More...
Public Member Functions inherited from StorageDriver
Promise< void > | close ()
| Closes the storage driver. More...
Promise< Record< string, any > > | getAll (context:StorageContext)
| Retrieves all the data stored in the specified storage space. More...
Function | onRemove (callback:(event:StorageDriverRemoveEvent)=> void)
| Subscribes to storage remove events and invokes the callback function whenever a remove event occurs. More...

## Additional Inherited Members
Public Attributes inherited from StorageDriver
boolean | isClosed
| Gets the current status of the storage driver, indicating whether it is closed or not. More...

## Detailed Description

The storage driver solution based on localStorage.

Since
  9.1.0

## Member Function Documentation

## ◆ get< T >()

async LocalStorageDriver::get< T > | ( | context:StorageContext | ,
|  | key:string |
| ) |  |
| inline

Retrieves the value associated with the specified key in the storage space. T The type of the value to retrieve.

Parameters

  context | StorageContext - The storage context, partitioning strategies based on the context's content.
  key | string - The key of the value to retrieve.

Returns
  Promise<T|null> - A promise that resolves to the retrieved value.

Since
  9.1.0

Implements StorageDriver.

## ◆ onChange< T >()

LocalStorageDriver::onChange< T > | ( | callback:(event:StorageDriverChangeEvent< T >) | ,
|  | void |
| ) |  |
| inline

Subscribes to storage change events and invokes the callback function whenever a change occurs. T - The type of value.

Parameters

  callback | (event:StorageDriverChangeEvent<T>)=>void - The callback function to handle storage change events

Returns
  ()=>void - A function to unsubscribe from the storage change events.

Since
  9.1.0

Implements StorageDriver.

## ◆ remove()

async LocalStorageDriver::remove | ( | context:StorageContext | ,
|  | key:string |
| ) |  |
| inline

Removes the value associated with the specified key in the storage space.

Parameters

  context | StorageContext - The storage context, partitioning strategies based on the context's content.
  key | string - The key of the value to remove.

Returns
  Promise<void> - A promise that resolves when the value is successfully removed.

Since
  9.1.0

Implements StorageDriver.

## ◆ removeAll()

async LocalStorageDriver::removeAll | ( | context:StorageContext |  | ) |
| inline

Removes all data stored in the specified storage space.

Parameters

  context | StorageContext - The storage context, partitioning strategies based on the context's content.

Returns
  Promise<void> - A promise that resolves when all data in the storage space is successfully removed.

Since
  9.1.0

Implements StorageDriver.

## ◆ set< T >()

async LocalStorageDriver::set< T > | ( | context:StorageContext | ,
|  | key:string | ,
|  | value:T |
| ) |  |
| inline

Store/Overwrite the value associated with the specified key in the storage space. T - The type of the value to store.

Parameters

  context | StorageContext - The storage context, partitioning strategies based on the context's content.
  key | string - The key of the value to store.
  value | T - The value to store.

Returns
  Promise<void> - A promise that resolves when the value is successfully set.

Since
  9.1.0

Implements StorageDriver.

@2025 Foxit Software Incorporated. All rights reserved.