Get started with localforage CDN
Apache-2.0 licensed
LocalForage is a lightweight, open-source library for key-value storage using the web indexedDB API.
Tags:- indexeddb
- localstorage
- storage
- websql
Stable version
Copied!
How to start using localforage CDN
// Include the localforage library
const LocalForage = require('localforage');
const LocalForageCdn = 'https://cdn.cdnhub.io/localforage/1.10.0/localforage.min.js';
// Load the library asynchronously
return new Promise((resolve) => {
const script = document.createElement('script');
script.src = LocalForageCdn;
script.onload = () => {
resolve(LocalForage);
};
document.head.appendChild(script);
});
// Initialize LocalForage
async function initLocalForage() {
const LocalForageInstance = await initPromise(LocalForage);
localStorage.clear(); // Clear local storage for testing
const localforage = new LocalForageInstance.default();
// Set data
await localforage.setItem('name', 'John Doe');
await localforage.setItem('age', 30);
// Get data
const name = await localforage.getItem('name');
const age = await localforage.getItem('age');
console.log('Name:', name); // John Doe
console.log('Age:', age); // 30
}
initLocalForage();
Copied!
Copied!
Copied!
Copied!
All versions
0.0.1
0.1.0
0.1.1
0.2.0
0.3.0
0.3.1
0.6.0
0.6.1
0.6.2
0.7.0
0.8.0
0.8.1
0.9.0
0.9.1
0.9.2
0.9.3
1.0.0
1.0.1
1.0.2
1.0.3
1.0.4
1.1.0
1.1.1
*** 1.10.0
1.2.0
1.2.1
1.2.10
1.2.2
1.2.3
1.2.4
1.2.6
1.2.7
1.2.8
1.2.9
1.3.0
1.3.1
1.3.2
1.3.3
1.4.0
1.4.1
1.4.2
1.4.3
1.5.0
1.5.1
1.5.2
1.5.3
1.5.4
1.5.5
1.5.6
1.5.7
1.6.0
1.7.0
1.7.1
1.7.2
1.7.3
1.7.4
1.8.0
1.8.1
1.9.0