Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.
/ idb-request Public archive

Tiny IDBRequest wrapper that allows node style callbacks

Notifications You must be signed in to change notification settings

yields/idb-request

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

idb-request

Tiny IDBRequest wrapper that allows node style callbacks

Installation

Install with component(1):

$ component install yields/idb-request

Example

var request = require('request');
var db = window.indexedDB;

var req = db.open('baz', 2);
request(req, function(err, e){
  var db = e.target.result;
  req = db.open('baz', 1);

  request(req, function(err, e){
    assert(err);
    assert(err.stack);
    assert('Error' == err.constructor.name);
    assert('Event' == err.e.constructor.name);
    assert('DOMError' == err.error.constructor.name);
    assert(err.message == err.error.message);
    log(err.message); // => "The requested version (1) is less than the existing version (2)."
  });
});

License

MIT

About

Tiny IDBRequest wrapper that allows node style callbacks

Resources

Stars

Watchers

Forks

Packages

No packages published