-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample5.html
More file actions
46 lines (23 loc) · 857 Bytes
/
example5.html
File metadata and controls
46 lines (23 loc) · 857 Bytes
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
43
44
45
<pre>
POT JS Example 5: Network
Check source and browser console.
`put()` persists a value. The purpose of `save()` is to obtain
a reference to retrieve the entire KVS by at a later time.
This page connects to a local Swarm network.
To test it, use `make example5`, which will start a local Swarm
network and update the batch id literal in the pot.new() call
in this example, after creating a new batch. Note that some
other make rules will if it exists, re-use this batch id (file
.batch_id).
<img src=favicon.ico>
</pre>
<script src="lib/pot-web.js"></script>
<script>
(async () => {
await pot.ready()
kvs = new pot.Kvs("http://localhost:1633", "1cf0043bdc6dc6cea96cc9ddc568090425e4c18e56d47d2cb143769e8d57bf9b")
await kvs.put("hello", "POT!")
ref = await kvs.save()
console.log("tree root is:", ref)
})()
</script>