1 | <!doctype html>
|
2 | <html>
|
3 | <head>
|
4 | <meta charset="utf8" />
|
5 | <title>localForage no available driver example</title>
|
6 | </head>
|
7 | <body>
|
8 | <script>
|
9 | try {
|
10 | window.indexedDB.open = null;
|
11 | } catch (e) { }
|
12 | try {
|
13 | window.localStorage.setItem = null;
|
14 | } catch (e) { }
|
15 | try {
|
16 | window.openDatabase = null;
|
17 | } catch (e) { }
|
18 | </script>
|
19 | <script src="../dist/localforage.js"></script>
|
20 | <script>
|
21 | localforage.ready(function() {
|
22 | console.log('ready', arguments);
|
23 |
|
24 | localforage.setItem('testKey', 'testValue').then(function() {}, function() {
|
25 | console.log('setItem: ', arguments);
|
26 | });
|
27 |
|
28 | localforage.getItem('testKey').then(function() {}, function() {
|
29 | console.log('getItem: ', arguments);
|
30 | });
|
31 |
|
32 | })
|
33 | .then(function() {
|
34 |
|
35 | }, function() {
|
36 | console.log('ready().then', arguments);
|
37 | console.log('localforage.driver():', localforage.driver());
|
38 |
|
39 | localforage.setDriver(localforage.LOCALSTORAGE).then(function() {}, function() {
|
40 | console.log('setDriver', arguments);
|
41 | });
|
42 | });
|
43 | </script>
|
44 | </body>
|
45 | </html>
|