| FoxitPDFSDKforWeb v11.1.0 Archives Foxit PDF SDK for Web

Public Member Functions | Public Attributes | List of all members
StorageDriver Interface Reference
PDFViewCtrl » storage

Represents a storage driver. More...

Inheritance diagram for StorageDriver:

## Public Member Functions
Promise< void > | close ()
| Closes the storage driver. More...
pubic Promise< T|null > | 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...
Promise< Record< string, any > > | getAll (context:StorageContext)
| Retrieves all the data stored in the specified storage space. More...
Function | 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...
Function | onRemove (callback:(event:StorageDriverRemoveEvent)=> void)
| Subscribes to storage remove events and invokes the callback function whenever a remove event occurs. More...
Promise< void > | remove (context:StorageContext, key:string)
| Removes the value associated with the specified key in the storage space. More...
Promise< void > | removeAll (context:StorageContext)
| Removes all data stored in the specified storage space. More...
Promise< void > | 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 Attributes
boolean | isClosed
| Gets the current status of the storage driver, indicating whether it is closed or not. More...

## Detailed Description

Represents a storage driver.

Since
  9.1.0

## Member Function Documentation

## ◆ close()

Promise<void> StorageDriver::close | ( |  | ) |

Closes the storage driver.

This method is used to perform cleanup operations, such as closing database connections associated with the storage driver. After calling this method, further operations on the storage driver may not be possible until it is reinitialized or recreated. It's important to note that this method does not clear any data stored in the storage system.

Returns
  Promise<void> - A Promise that resolves when the storage driver is successfully closed, or rejects with an error if an issue occurs during the closing process.

See also
  isClosed

Since
  9.2.0

## ◆ get< T >()

pubic Promise<T|null> StorageDriver::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.

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

Implemented in IndexedDBStorageDriver, and LocalStorageDriver.

## ◆ getAll()

Promise<Record<string,any> > StorageDriver::getAll | ( | context:StorageContext |  | ) |

Retrieves all the data stored in the specified storage space.

Parameters

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

Returns
  Promise<Record<string, any>> - A promise that resolves to all the data stored in the storage space.

Since
  9.1.0

Implemented in IndexedDBStorageDriver.

## ◆ onChange< T >()

Function StorageDriver::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.

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

Implemented in IndexedDBStorageDriver, and LocalStorageDriver.

## ◆ onRemove()

Function StorageDriver::onRemove | ( | callback:(event:StorageDriverRemoveEvent) | ,
|  | void |
| ) |  |

Subscribes to storage remove events and invokes the callback function whenever a remove event occurs.

Parameters

  callback | (event:StorageDriverRemoveEvent)=>void - The callback function to handle storage remove events.

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

Since
  9.1.0

Implemented in IndexedDBStorageDriver.

## ◆ remove()

Promise<void> StorageDriver::remove | ( | context:StorageContext | ,
|  | key:string |
| ) |  |

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

Implemented in LocalStorageDriver.

## ◆ removeAll()

Promise<void> StorageDriver::removeAll | ( | context:StorageContext |  | ) |

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

Implemented in IndexedDBStorageDriver, and LocalStorageDriver.

## ◆ set< T >()

Promise<void> StorageDriver::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.

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

Implemented in IndexedDBStorageDriver, and LocalStorageDriver.

## Member Data Documentation

## ◆ isClosed

boolean StorageDriver::isClosed

Gets the current status of the storage driver, indicating whether it is closed or not.

See also
  close()

Since
  9.2.0

@2026 Foxit Software Incorporated. All rights reserved.