-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhatever.html
42 lines (40 loc) · 1.18 KB
/
whatever.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!doctype html>
<html>
<head>
<!-- Include Dexie -->
<script src="https://unpkg.com/dexie@latest/dist/dexie.js"></script>
<script>
//
// Define your database
//
var db = new Dexie("friend_database");
db.version(1).stores({
friends: 'name,shoeSize'
});
//
// Put some data into it
//
db.friends.put({name: "Nicolas", shoeSize: 8}).then (function(){
//
// Then when data is stored, read from it
//
return db.friends.get('Nicolas');
}).then(function (friend) {
//
// Display the result
//
alert ("Nicolas has shoe size " + friend.shoeSize);
}).catch(function(error) {
//
// Finally don't forget to catch any error
// that could have happened anywhere in the
// code blocks above.
//
alert ("Ooops: " + error);
});
</script>
</head>
<body>
<p><a href="https://dexie.org/docs/Tutorial/Getting-started">Getting Started</a></p>
</body>
</html>