/*! * Jodit Editor (https://xdsoft.net/jodit/) * Released under MIT see LICENSE.txt in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net */ /** * @module types */ export type StorageValueType = string | number | boolean | object | StorageValueType[]; export interface IStorage { set(key: string, value: T): this; delete(key: string): this; get(key: string): R | void; exists(key: string): boolean; clear(): this; } export interface IAsyncStorage { set(key: string, value: T): Promise; delete(key: string): Promise; get(key: string): Promise; exists(key: string): Promise; clear(): Promise; close(): Promise; } /** * Which provider should back an {@link IAsyncStorage} created by * `AsyncStorage.makeStorage`: * - `'local'` — use `localStorage` (falls back to memory if it is blocked); * - `'memory'` — use an in-memory store (nothing survives a page reload); * - a custom {@link IAsyncStorage} implementation — use it as-is. */ export type AsyncStorageDefaultProvider = 'local' | 'memory' | IAsyncStorage; export interface IAsyncStorageOptions { /** * Overrides the provider that backs the storage. When omitted the storage * behaves as before — persistent `IndexedDB` with an in-memory fallback. */ defaultProvider?: AsyncStorageDefaultProvider; }