IDBTransactionSync - Web APIs 编辑

Draft

This page is not complete.

Important: The synchronous version of the IndexedDB API was originally intended for use only with Web Workers, and was eventually removed from the spec because its need was questionable. It may however be reintroduced in the future if there is enough demand from web developers.

The IDBTransactionSync interface of the IndexedDB API provides a synchronous transaction on a database. When an application creates an IDBTransactionSync object, it blocks until the browser is able to reserve the require database objects.

Method overview

void abort() raises (IDBDatabaseException);
void commit() raises (IDBDatabaseException);
IDBObjectStoreSync objectStore(in DOMString name) raises (IDBDatabaseException);

Attributes

AttributeTypeDescription
dbIDBDatabaseSyncThe database connection that this transaction is associated with.
staticbooleanIf true, this transaction is static; if false, this transaction is dynamic.

Methods

abort()

Call this method to signal a need to cancel the effects of the operations performed by this transaction. When this method is called, the browser ignores all the changes performed to the objects of this database since this transaction was created.

void abort(
) raises (IDBDatabaseException);
Exceptions

This method can raise an IDBDatabaseException with the following code:

NON_TRANSIENT_ERR
If this transaction has already been committed or aborted.

commit()

Call this method to signal that the transaction has completed normally and satisfactorily. When this method is called, the browser durably stores all the changes performed to the objects of the database since this transaction was created.

void commit(
) raises (IDBDatabaseException);
Exceptions

This method can raise an IDBDatabaseException with the following codes:

NON_TRANSIENT_ERR
If this transaction has already been committed or aborted.
RECOVERABLE_ERR
If this transaction's scope is dynamic, and the browser cannot commit all of the changes due to another transaction.

objectStore()

Returns an object store that has already been added to the scope of this transaction.

IDBObjectStoreSync objectStore(
  in DOMString name
) raises (IDBDatabaseException);
Parameters
name
The name of the requested object store.
Returns
IDBObjectStoreSync
An object for accessing the requested object store.
Exceptions

The method can raise an IDBDatabaseException with the following code:

NOT_FOUND_ERR
If the requested object store is not in this transaction's scope.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:68 次

字数:5600

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文