code: function onsuccess(event) {
              // remember the db instance
              self.db = event.target.result;
  
              // storage is now possible
              self.store = true;
  
              // execute all pending operations
              while (self.waiting.length) {
                  self.waiting.shift().call(self);
              }
  
              // we're done, fire the callback
              if (cb) {
                  cb.call(self, self);
              }
          }
docs: database is ready for use