You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Try to subscribe a topic with Pubsub and receive the current local value if available.
69
75
70
76
Arguments:
71
77
72
78
-`key` (Buffer): a key representing a unique identifier of the object to subscribe.
73
-
-`callback` (function): operation result.
74
79
75
-
`callback` must follow `function (err, data) {}` signature, where `err` is an error if the operation was not successful. If no `err` is received, a `data` is received containing the most recent known record stored (`Buffer`).
80
+
Returns `Promise<Buffer>`containing the most recent known record stored.
76
81
77
82
#### Put
78
83
79
84
```js
80
-
dsPubsub.put(key, val, callback)
85
+
awaitdsPubsub.put(key, val)
81
86
```
82
87
83
88
Publishes a value through pubsub.
@@ -86,14 +91,13 @@ Arguments:
86
91
87
92
-`key` (Buffer): a key representing a unique identifier of the object to publish.
88
93
-`val` (Buffer): value to be propagated.
89
-
-`callback` (function): operation result.
90
94
91
-
`callback` must follow `function (err) {}` signature, where `err` is an error if the operation was not successful.
95
+
Returns `Promise<void>`
92
96
93
97
#### Unsubscribe
94
98
95
99
```js
96
-
dsPubsub.unsubscribe(key, callback)
100
+
awaitdsPubsub.unsubscribe(key)
97
101
```
98
102
99
103
Unsubscribe a previously subscribe value.
@@ -102,6 +106,8 @@ Arguments:
102
106
103
107
-`key` (Buffer): a key representing a unique identifier of the object to publish.
104
108
109
+
Returns `Promise<void>`
110
+
105
111
## Contribute
106
112
107
113
Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipns/issues)!
0 commit comments