Line 1: |
Line 1: |
| + | console.log("~"); |
| console.log("~"); | | console.log("~"); |
| | | |
Line 21: |
Line 22: |
| | | |
| // Add some data | | // Add some data |
− | var John = {id: 12345, name: {first: "John", last: "Doe"}, age: 42, phone: '+33123456789'}; | + | // var John = {id: 12345, name: {first: "John", last: "Doe"}, age: 42, phone: '+33123456789'}; |
− | var Bob = {id: 67890, name: {first: "Bob", last: "Smith"}, age: 35} | + | // var Bob = {id: 67890, name: {first: "Bob", last: "Smith"}, age: 35} |
− | store.put(John); | + | // store.put(John); |
− | store.put(Bob); | + | // store.put(Bob); |
| | | |
| | | |
Line 30: |
Line 31: |
| var getJohn = store.get(12345); | | var getJohn = store.get(12345); |
| var getBob = index.get(["Smith", "Bob"]); | | var getBob = index.get(["Smith", "Bob"]); |
− | // store.put(getBob, +{phone: '+123'});
| + | console.log(getJohn); |
| | | |
| getJohn.onsuccess = function() { | | getJohn.onsuccess = function() { |
− | console.log(getJohn.result.phone); // => "John" | + | console.log(getJohn); // => "John" |
| }; | | }; |
| | | |
| getBob.onsuccess = function() { | | getBob.onsuccess = function() { |
− | console.log(getBob.result.phone); // => "Bob" | + | console.log(getBob); // => "Bob" |
| }; | | }; |
| | | |