diff --git a/assets/highlight.css b/assets/highlight.css index 1610a78..023b7f9 100644 --- a/assets/highlight.css +++ b/assets/highlight.css @@ -1,28 +1,28 @@ :root { - --light-hl-0: #000000; - --dark-hl-0: #D4D4D4; - --light-hl-1: #A31515; - --dark-hl-1: #CE9178; - --light-hl-2: #800000; - --dark-hl-2: #808080; + --light-hl-0: #795E26; + --dark-hl-0: #DCDCAA; + --light-hl-1: #000000; + --dark-hl-1: #D4D4D4; + --light-hl-2: #A31515; + --dark-hl-2: #CE9178; --light-hl-3: #800000; - --dark-hl-3: #569CD6; - --light-hl-4: #000000FF; - --dark-hl-4: #D4D4D4; - --light-hl-5: #E50000; - --dark-hl-5: #9CDCFE; - --light-hl-6: #0000FF; - --dark-hl-6: #CE9178; - --light-hl-7: #AF00DB; - --dark-hl-7: #C586C0; - --light-hl-8: #001080; - --dark-hl-8: #9CDCFE; - --light-hl-9: #0000FF; - --dark-hl-9: #569CD6; - --light-hl-10: #0070C1; - --dark-hl-10: #4FC1FF; - --light-hl-11: #795E26; - --dark-hl-11: #DCDCAA; + --dark-hl-3: #808080; + --light-hl-4: #800000; + --dark-hl-4: #569CD6; + --light-hl-5: #000000FF; + --dark-hl-5: #D4D4D4; + --light-hl-6: #E50000; + --dark-hl-6: #9CDCFE; + --light-hl-7: #0000FF; + --dark-hl-7: #CE9178; + --light-hl-8: #AF00DB; + --dark-hl-8: #C586C0; + --light-hl-9: #001080; + --dark-hl-9: #9CDCFE; + --light-hl-10: #0000FF; + --dark-hl-10: #569CD6; + --light-hl-11: #0070C1; + --dark-hl-11: #4FC1FF; --light-code-background: #FFFFFF; --dark-code-background: #1E1E1E; } diff --git a/classes/PubSubDatastore.html b/classes/PubSubDatastore.html index 0ecd07d..aa7db09 100644 --- a/classes/PubSubDatastore.html +++ b/classes/PubSubDatastore.html @@ -1,4 +1,4 @@ -
handles pubsub subscription messages
Store the received record if it is better than the current stored
Optional
options: AbortOptionsOptional
options: AbortOptionsadd record to datastore
Optional
options: AbortOptionsOptional
options: AbortOptionsTry to subscribe a topic with Pubsub and returns the local value if available
Optional
options: AbortOptionsOptional
options: AbortOptionsOverrides BaseDatastore.get
Publishes a value through pubsub.
value to be propagated.
Optional
options: AbortOptionsOptional
options: AbortOptionsOverrides BaseDatastore.put
$ npm i datastore-pubsub
+$ npm i datastore-pubsub
Browser <script>
tag
Loading this module through a script tag will make it's exports available as DatastorePubsub
in the global namespace.
-<script src="https://unpkg.com/datastore-pubsub/dist/index.min.js"></script>
+<script src="https://unpkg.com/datastore-pubsub/dist/index.min.js"></script>
Usage
-import { PubSubDatastore } from 'datastore-pubsub'
const dsPubsub = new PubSubDatastore(pubsub, datastore, peerId, validator)
+import { PubSubDatastore } from 'datastore-pubsub'
const dsPubsub = new PubSubDatastore(pubsub, datastore, peerId, validator)
@@ -75,7 +71,7 @@ API
Setup
-new PubSubDatastore(pubsub, datastore, peerId, validator, subscriptionKeyFn)
+new PubSubDatastore(pubsub, datastore, peerId, validator, subscriptionKeyFn)
Creates a DatastorePubsub instance.
Arguments:
@@ -87,13 +83,13 @@ Setup
subscriptionKeyFn
(function): function to manipulate the key topic received according to the needs, as well as to block the message received to be published.
Note: validator
object must be composed by two functions, validate (record: uint8Array, peerId: PeerId) => boolean
and select (received: uint8Array, current: uint8Array) => boolean
. validate
aims to verify if a new record received by pubsub is valid to be stored locally by the node. If it is valid and the node already has a local record stored, select
is the function provided to be responsible for deciding which record is the best (newer) between the already stored and the received through pubsub. A validator
example can be found at: TODO (js-ipns)
-const dsPubsub = new DatastorePubsub(pubsub, datastore, peerId, validator)
+const dsPubsub = new DatastorePubsub(pubsub, datastore, peerId, validator)
Get
-const buf = await dsPubsub.get(key)
+const buf = await dsPubsub.get(key)
Try to subscribe a topic with Pubsub and receive the current local value if available.
Arguments:
@@ -105,7 +101,7 @@ Get
Put
-await dsPubsub.put(key, val)
+await dsPubsub.put(key, val)
Publishes a value through pubsub.
Arguments:
@@ -118,7 +114,7 @@ Put
Unsubscribe
-await dsPubsub.unsubscribe(key)
+await dsPubsub.unsubscribe(key)
Unsubscribe a previously subscribe value.
Arguments:
@@ -127,13 +123,6 @@ Unsubscribe
Returns Promise<void>
-
- Contribute
-
-Feel free to join in. All welcome. Open an issue!
-This repository falls under the IPFS Code of Conduct.
-
-
API Docs
@@ -150,7 +139,7 @@ License
MIT (LICENSE-MIT / http://opensource.org/licenses/MIT)
-
+
Contribute
Contributions welcome! Please check out the issues.
@@ -178,7 +167,7 @@ Theme
Class PubSubDatastore