Update README.md
Showing
1 changed file
with
6 additions
and
6 deletions
... | @@ -20,20 +20,20 @@ localStorage.clear(); | ... | @@ -20,20 +20,20 @@ localStorage.clear(); |
20 | 20 | ||
21 | var random1 = Math.random().toString(36).substring(7); | 21 | var random1 = Math.random().toString(36).substring(7); |
22 | var gun1 = Gun({peers:["https://gundb-multiserver.glitch.me/"+random1], musticast: false, localStorage: false, radisk: false, file: false}); | 22 | var gun1 = Gun({peers:["https://gundb-multiserver.glitch.me/"+random1], musticast: false, localStorage: false, radisk: false, file: false}); |
23 | gun1.get('zero1').put({ name: "Jack" }); | 23 | gun1.get('jack').put({ name: "Jack" }); |
24 | // This should be triggered | 24 | // This should be triggered |
25 | gun1.get('zero1').on(function(data, key){ | 25 | gun1.get('jack').on(function(data, key){ |
26 | console.log("gun 1 update:", data); | 26 | console.log("gun 1 update:", data); |
27 | }); | 27 | }); |
28 | // This should never be triggered | 28 | // This should never be triggered |
29 | gun1.get('zero2').on(function(data, key){ | 29 | gun1.get('jill').on(function(data, key){ |
30 | console.log("gun 1-2 update:", data); | 30 | console.log("Jack should NOT see Jill's update", data); |
31 | }); | 31 | }); |
32 | 32 | ||
33 | var random2 = Math.random().toString(36).substring(7); | 33 | var random2 = Math.random().toString(36).substring(7); |
34 | var gun2 = Gun({peers:["https://gundb-multiserver.glitch.me/"+random2], multicast: false, localStorage: false, radisk: false, file: false}); | 34 | var gun2 = Gun({peers:["https://gundb-multiserver.glitch.me/"+random2], multicast: false, localStorage: false, radisk: false, file: false}); |
35 | gun2.get('zero2').put({ name: "Jill"}); | 35 | gun2.get('jill').put({ name: "Jill"}); |
36 | gun2.get('zero2').on(function(data, key){ | 36 | gun2.get('jill').on(function(data, key){ |
37 | console.log("gun 2 update:", data); | 37 | console.log("gun 2 update:", data); |
38 | }); | 38 | }); |
39 | ``` | 39 | ``` | ... | ... |
-
Please register or sign in to post a comment