Skip to content

IDBTransaction should become a Future as well #49

@inexorabletash

Description

@inexorabletash

In the "reworked APIs" section, IDBRequest becomes a subclass of Future.

IDBTransaction behaves similarly, although it's not as simple a type as a IDBRequest. A transaction has a lifetime bounded by other asynchronous activity, after which it completes successfully ("complete" event) or fails ("abort" event), and in both cases action is likely to be taken by the script.

With current IDB you write:

  tx = db.transaction(...);
  tx.objectStore(...).put(...);
  tx.oncomplete = function() { alert("yay, done"); };

I'd expect a Future-ish IDB to let me write:

  tx = db.transaction(...);
  tx.objectStore(...).put(...);
  tx.then(function() { alert("yay, done"); });

... which of course gets more useful when you have join() operations letting you wait on multiple futures and all that other goodness.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions