src/common/idb.js
function putAsset(key, content) {
  return new Promise((resolve, reject) => {
    return instance.assets.then(db => {
      const obj = db.transaction(db.name, 'readwrite')
        .objectStore(db.name);
      const req = obj.put({key: key, value: content});
      req.onerror = event => reject(event);
      req.onsuccess = () => resolve();
    });
  });
}
function putAsset(key, content) {
  return new Promise((resolve, reject) => {
    return instance.assets.then(db => {
      const obj = db.transaction(db.name, 'readwrite')
        .objectStore(db.name);
      const req = obj.put({key: key, value: content});
      req.onerror = event => reject(event);
      req.onsuccess = () => resolve();
    });
  });
}
function putAsset ( key , content ) { return new Promise ( ( resolve , reject ) => { return instance . assets . then ( db => { const obj = db . transaction ( db . name , 'readwrite' ) . objectStore ( db . name ) ; const req = obj . put ( { key : key , value : content } ) ; req . onerror = event => reject ( event ) ; req . onsuccess = ( ) => resolve ( ) ; } ) ; } ) ; }
Put asset object with a key
@param {string} key - key
@param {string} content - asset to store
Put asset object with a key