timbru31

dexie-outside-worker

Oct 2nd, 2017
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.24 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Testing Safari issue with IDBObjectStore.getAll()</title>
  6. </head>
  7. <body>
  8. <h1>Testing Safari issue with IDBObjectStore.getAll()</h1>
  9. <p>Status: <span id="statusText"></span></p>
  10. <p>navigator.userAgent: <span id="uaText"></span></p>
  11. <p>navigator.vendor: <span id="vendorText"></span></p>
  12. <p>navigator.appVersion: <span id="appVersionText"></span></p>
  13. <script src="dexie.js"></script>
  14. <script type="text/javascript">
  15. var db = new Dexie('testdb');
  16. db.version(1).stores({
  17.   items: 'id',
  18. });
  19. db.open().then(()=>{
  20.   console.log("Could open. Now putting an item into DB");
  21.   return db.items.put({id: 1, name: "foo"});
  22. }).then(()=> {
  23.   console.log("Could put item. Now trying IDBObjectStore.getAll()");
  24.   return db.items.toArray();
  25. }).then(()=>{
  26.   console.log("Successfully called IDBObjectStore.getAll()");
  27. }).catch(err => {
  28.   console.log("Fail calling IDBObjectStore.getAll() from a worker. Error: " + err);
  29. });
  30.  
  31.   document.getElementById('uaText').innerText = navigator.userAgent;
  32.   document.getElementById('vendorText').innerText = navigator.vendor;
  33.   document.getElementById('appVersionText').innerText = navigator.appVersion;
  34. </script>
  35.  
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment