You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Insert or update one or multiple records into the object stores
/** * Insert or update one record in the object store * * @param {String} objStoreName name of object store * @param {Mixed} data * @return {Promise} * @param {DOMError} [err] if promise is rejected * @param {*} inserted/updated object key otherwise */constconn=awaitsklad.open('dbName');try{constupsertedKey=awaitconn.upsert('objStoreName',{foo: 'bar'});}catch(err){// check err.name to get the reason of error// err.message will also be usefulthrownewError(err.message);}/** * Insert or update multiple records in the object stores (during one transaction) * * @param {Object} data * @return {Promise} * @param {DOMError} [err] if promise is rejected * @param {Object} inserted/updated objects' keys otherwise */constconn=awaitsklad.open('dbName');try{constupsertedKeys=awaitconn.upsert({'objStoreName_1': ['Lorem','ipsum','dolor','sit','amet'],'objStoreName_2': [{foo: 'bar'},{foo: 'bar'}]});assert.equal(upsertedKeys,{objStoreName_1: [key1,key2,key3,key4,key5]objStoreName_2: [key6,key7]});}catch(err){// check err.name to get the reason of error// err.message will also be usefulthrownewError(err.message);}