跳到主要內容

發表文章

目前顯示的是 5月, 2015的文章

IndexedDB Database API - Add Object

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"; ...

Indexed Database API - Initail

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, ...

Morris bar chart enhancement

Morris is the public API which help you to create good looking bar/ area /line charts. The post refer to Morris API enhance bar chart feature that could set bar chart with axis without starting at 0. Please see the following link. If you would like to know how is going, search key word "isMultiData" in "morris.js" file. Enjoy it! example here: morris bar chart enhancement