1.0.9 • Published 6 years ago

indexeddb-cache-json v1.0.9

Weekly downloads
14
License
ISC
Repository
github
Last release
6 years ago

匹配url,含义cache=true进行缓存;匹配到cache=networkFirst 网络优先,离线走缓存, 配合fetch请求优化数据加载

// 不支持serviceWorker则启用IndexedDB

const dbName = 'hoopoe-idb'; const tableName = 'hoopoe-idb-json';

IDB.init('hoopoe-idb', 'hoopoe-idb-json', 1, !navigator.serviceWorker) .then(()=>{

IDB.getDB(dbName, tableName).setItem(_url, data);

IDB.getDB(dbName, tableName).getItem(_url).then((cacheData) => {
       
});

}) .catch((err) => { console.error(err); });

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago