localForage/examples/no-driver.html
2014-06-26 22:11:02 +03:00

46 lines
1.2 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset="utf8" />
<title>localForage no available driver example</title>
</head>
<body>
<script>
try {
window.indexedDB.open = null;
} catch (e) { }
try {
window.localStorage.setItem = null;
} catch (e) { }
try {
window.openDatabase = null;
} catch (e) { }
</script>
<script src="../dist/localforage.js"></script>
<script>
localforage.ready(function() {
console.log('ready', arguments);
localforage.setItem('testKey', 'testValue').then(function() {}, function() {
console.log('setItem: ', arguments);
});
localforage.getItem('testKey').then(function() {}, function() {
console.log('getItem: ', arguments);
});
})
.then(function() {
}, function() {
console.log('ready().then', arguments);
console.log('localforage.driver():', localforage.driver());
localforage.setDriver(localforage.LOCALSTORAGE).then(function() {}, function() {
console.log('setDriver', arguments);
});
});
</script>
</body>
</html>