Guest User

Untitled

a guest
Aug 14th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. storing a three.js mesh object with indexedDB
  2. object = new THREE.Mesh( geometry, material );
  3.  
  4. webkitIndexedDB.open("MyNewDB").onsuccess = function(event) {
  5. window.db = event.srcElement.result;
  6.  
  7. window.db.setVersion("1.0").onsuccess = function(event) {
  8. var objectStore = window.db.createObjectStore("meshes", { keyPath: "item_id" });
  9.  
  10. objectStore.add({item_id: 0, mesh: object}); // <= this is the crucial line
  11.  
  12. };
  13. };
Add Comment
Please, Sign In to add comment