1.0.9 • Published 5 years ago

indexeddb-cache-json v1.0.9

Weekly downloads
14
License
ISC
Repository
github
Last release
5 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

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago