The post refer to add object items to the target indexedDB after indexedDB initialization. The add() method of the IDBObjectStore interface is an only insert method. We could use the transaction object to which this object store belongs and add items to. How to start it? //*************************************************************** //addData //{Object}, {db: dbName, objectStore: storeName, version: number, data: data}, the database info include db name, store name , version and object data need to be added. //********************************************************************** function addData (data) { var targetDB = {}; var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB; var nameStore = data.hasOwnProperty("objectStore") ? data.objectStore : "list"; var nameDB = data.hasOwnProperty("db") ? data.db : data; var dbVersion = data.hasOwnProperty("version") ? data.version : "2"; ...
As a front web developer, I could create UI faster or Optimize file to load page faster. But it hard to faster response time form server however 80-90% of the end-user response time is spent on the frontend. Nowadays we could use the Indexed Database API, or IndexedDB to reduce the request times. Less request times, less response time. What is IndexedDB ? IndexedDB is web browser standard interface for a local database of records holding simple values and hierarchical objects. IndexedDB was initially proposed by Oracle in 2009./* wiki */ What browsers would support IndexedDB ? Most browsers of hybrid devices support it exclude IE9-, Safari 7-,iOS Safari 7.1-, Opera Mini, Android Browser 4.3-./* caniuse.com */ When shall we use IndexedDB ? Save Money on web hosting Data index sort Data keyword search Keep data for period of time How to start it? //*************************************************************** //initDB //{Object}, {data: dbName, objectStore: storeName, ...