IndexedDB🧪
✅️️ Methods
🔨IndexedDB.clearObjectStore
清除对象存储中的所有条目。
EN
Clears all entries from an object store.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| securityOrigin | string | 至少且最多必须指定 securityOrigin、storageKey 或 storageBucket 中的一个。安全来源。 | ENAt least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. | ||
| storageKey | string | 存储键。 | ENStorage key. | ||
| storageBucket | Storage.StorageBucket | 存储桶。如果未指定,则使用默认桶。 | ENStorage bucket. If not specified, it uses the default bucket. | ||
| databaseName | ✔️ | string | 数据库名称。 | ENDatabase name. | |
| objectStoreName | ✔️ | string | 对象存储名称。 | ENObject store name. |
🔨IndexedDB.deleteDatabase
删除一个数据库。
EN
Deletes a database.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| securityOrigin | string | 至少且最多必须指定 securityOrigin、storageKey 或 storageBucket 中的一个。安全来源。 | ENAt least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. | ||
| storageKey | string | 存储键。 | ENStorage key. | ||
| storageBucket | Storage.StorageBucket | 存储桶。如果未指定,则使用默认桶。 | ENStorage bucket. If not specified, it uses the default bucket. | ||
| databaseName | ✔️ | string | 数据库名称。 | ENDatabase name. |
🔨IndexedDB.deleteObjectStoreEntries
从对象存储中删除一系列条目
EN
Delete a range of entries from an object store
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| securityOrigin | string | 至少且至多必须指定securityOrigin、storageKey或storageBucket中的一个。Security origin。 | ENAt least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. | ||
| storageKey | string | 存储键。 | ENStorage key. | ||
| storageBucket | Storage.StorageBucket | 存储桶。如果未指定,则使用默认存储桶。 | ENStorage bucket. If not specified, it uses the default bucket. | ||
| databaseName | ✔️ | string | |||
| objectStoreName | ✔️ | string | |||
| keyRange | ✔️ | KeyRange | 要删除的条目键范围 | ENRange of entry keys to delete |
🔨IndexedDB.disable
禁用来自后端的事件。
EN
Disables events from backend.
🔨IndexedDB.enable
启用来自后端的事件。
EN
Enables events from backend.
🔨IndexedDB.getMetadata
获取对象存储的元数据。
EN
Gets metadata of an object store.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| securityOrigin | string | 至少且至多必须指定 securityOrigin、storageKey 或 storageBucket 中的一个。安全来源。 | ENAt least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. | ||
| storageKey | string | 存储键。 | ENStorage key. | ||
| storageBucket | Storage.StorageBucket | 存储桶。如果未指定,则使用默认桶。 | ENStorage bucket. If not specified, it uses the default bucket. | ||
| databaseName | ✔️ | string | 数据库名称。 | ENDatabase name. | |
| objectStoreName | ✔️ | string | 对象存储名称。 | ENObject store name. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| entriesCount | number | 条目数量 | ENthe entries count |
| keyGeneratorValue | number | 键生成器的当前值,将成为对象存储中下一个插入的键。仅在objectStore.autoIncrement为true时有效。 | ENthe current value of key generator, to become the next inserted key into the object store. Valid if objectStore.autoIncrement is true. |
🔨IndexedDB.requestData
从对象存储或索引中请求数据。
EN
Requests data from object store or index.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| securityOrigin | string | 至少且最多必须指定 securityOrigin、storageKey 或 storageBucket 中的一个。安全来源。 | ENAt least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. | ||
| storageKey | string | 存储键。 | ENStorage key. | ||
| storageBucket | Storage.StorageBucket | 存储桶。如果未指定,则使用默认桶。 | ENStorage bucket. If not specified, it uses the default bucket. | ||
| databaseName | ✔️ | string | 数据库名称。 | ENDatabase name. | |
| objectStoreName | ✔️ | string | 对象存储名称。 | ENObject store name. | |
| indexName | string | 索引名称。如果未指定,则执行对象存储数据请求。 | ENIndex name. If not specified, it performs an object store data request. | ||
| skipCount | ✔️ | integer | 要 跳过的记录数量。 | ENNumber of records to skip. | |
| pageSize | ✔️ | integer | 要获取的记录数量。 | ENNumber of records to fetch. | |
| keyRange | KeyRange | 键值范围。 | ENKey range. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| objectStoreDataEntries | array[DataEntry] | 对象存储数据条目的数组。 | ENArray of object store data entries. |
| hasMore | boolean | 如果为真,则在给定范围内还有更多条目需要获取。 | ENIf true, there are more entries to fetch in the given range. |
🔨IndexedDB.requestDatabase
在给定的框架中请求指定名称的数据库。
EN
Requests database with given name in given frame.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| securityOrigin | string | 至少且最多必须指定 securityOrigin、storageKey 或 storageBucket 中的一个。安全来源。 | ENAt least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. | ||
| storageKey | string | 存储键。 | ENStorage key. | ||
| storageBucket | Storage.StorageBucket | 存储桶。如果未指定,则使用默认存储桶。 | ENStorage bucket. If not specified, it uses the default bucket. | ||
| databaseName | ✔️ | string | 数据库名称。 | ENDatabase name. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| databaseWithObjectStores | DatabaseWithObjectStores | 包含对象存储数组的数据库。 | ENDatabase with an array of object stores. |
🔨IndexedDB.requestDatabaseNames
为指定的安全源请求数据库名称。
EN
Requests database names for given security origin.
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| securityOrigin | string | 至少且至多必须指定 securityOrigin、storageKey 或 storageBucket 中的一个。安全来源。 | ENAt least and at most one of securityOrigin, storageKey, or storageBucket must be specified. Security origin. | ||
| storageKey | string | 存储键。 | ENStorage key. | ||
| storageBucket | Storage.StorageBucket | 存储桶。如果未指定,则使用默认桶。 | ENStorage bucket. If not specified, it uses the default bucket. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| databaseNames | array[string] | ''和``内的内容保持不变,以下是翻译: 来源的数据库名称。 | ENDatabase names for origin. |
✅️️ Types
📌IndexedDB.DatabaseWithObjectStores
包含对象存储数组的数据库。
EN
Database with an array of object stores.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| name | ✔️ | string | 数据库名称。 | ENDatabase name. | |
| version | ✔️ | number | 数据库版本(类型不是'integer',因为标准要求版本号必须是'unsigned long long') | ENDatabase version (type is not 'integer', as the standard requires the version number to be 'unsigned long long') | |
| objectStores | ✔️ | array[ObjectStore] | 此数据库中的对象存储。 | ENObject stores in this database. |
📌IndexedDB.DataEntry
数据录入。
EN
Data entry.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| key | ✔️ | Runtime.RemoteObject | 关键对象。 | ENKey object. | |
| primaryKey | ✔️ | Runtime.RemoteObject | 主键对象。 | ENPrimary key object. | |
| value | ✔️ | Runtime.RemoteObject | 值对象。 | ENValue object. |
📌IndexedDB.Key
Key
EN
Key.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| type | ✔️ | string | 键类型。 允许的值: number、string、date、array | ENKey type.Allowed Values: number, string, date, array | |
| number | number | 数值。 | ENNumber value. | ||
| string | string | 字符串值。 | ENString value. | ||
| date | number | 日期值。 | ENDate value. | ||
| array | array[Key] | 数组值。 | ENArray value. |
📌IndexedDB.KeyPath
关键路径。
EN
Key path.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| type | ✔️ | string | 关键路径类型。 允许的值: null、string、array | ENKey path type.Allowed Values: null, string, array | |
| string | string | 字符串值。 | ENString value. | ||
| array | array[string] | 数组值。 | ENArray value. |
📌IndexedDB.KeyRange
键范围。
EN
Key range.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| lower | Key | 下界。 | ENLower bound. | ||
| upper | Key | 上限。 | ENUpper bound. | ||
| lowerOpen | ✔️ | boolean | 如果为真,下界是开放的。 | ENIf true lower bound is open. | |
| upperOpen | ✔️ | boolean | 如果为真,则上限是开放的。 | ENIf true upper bound is open. |
📌IndexedDB.ObjectStore
对象存储。
EN
Object store.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| name | ✔️ | string | 对象存储名称。 | ENObject store name. | |
| keyPath | ✔️ | KeyPath | 对象存储键路径。 | ENObject store key path. | |
| autoIncrement | ✔️ | boolean | 如果为真,对象存储已设置自动递增标志。 | ENIf true, object store has auto increment flag set. | |
| indexes | ✔️ | array[ObjectStoreIndex] | 此对象存储中的索引。 | ENIndexes in this object store. |
📌IndexedDB.ObjectStoreIndex
对象存储索引。
EN
Object store index.
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| name | ✔️ | string | 索引名称。 | ENIndex name. | |
| keyPath | ✔️ | KeyPath | 索引键路径。 | ENIndex key path. | |
| unique | ✔️ | boolean | 如果为真,索引是唯一的。 | ENIf true, index is unique. | |
| multiEntry | ✔️ | boolean | 如果为 true,索引允许一个键对应多个条目。 | ENIf true, index allows multiple entries for a key. |