git ssb

0+

Piet / ssb-loomio



Commit f27bf8aaaf68d1e696f1403368303317c975cc5d

ahuh

Piet Geursen committed on 3/12/2018, 2:00:22 AM
Parent: d2a8bebd8082181882ad9ee29e93d8df75abcb15

Files changed

README.mdchanged
methods.jschanged
README.mdView
@@ -9,39 +9,54 @@
99 - github: `git@github.com:ssbc/scuttle-poll.git`
1010
1111 ## Usage
1212
13 +### Init
1314 ```js
14-var isPoll = require('scuttle-poll/isPoll')
15-
16-isPoll(msg)
17-// => Boolean
15 +var Sbot = require('ssb-client')
16 +Sbot((err, server) => {
17 + if (err) {
18 + return console.log(err)
19 + }
20 + var ScuttlePoll = require('scuttle-poll')
21 + var scuttlePoll = ScuttlePoll(server)
22 +})
1823 ```
24 +where `server` is a scuttlebot instance (or a remote connection provided by `ssb-client`)
1925
26 +Note - `server` can also be an observeable which resolves to a scuttlebot instance
27 +(this is more experimental, it will turn your sync functions into obs functions)
28 +
29 +This returns an object with methods defined in `methods.js` that looks like:
30 +
2031 ```js
21-var scuttle = require('scuttle-poll')(server)
2232
23-var opts = {
24- title: 'where shall we have our community meeting?'
25- choices: [
26- 'in person',
27- 'talky.io',
28- 'mumble',
29- ]
33 +{
34 + poll: {
35 + async: {
36 + chooseOne:
37 + get:
38 + },
39 + sync: {
40 + isPoll:
41 + isChooseOnePoll:
42 + }
43 + },
44 + position: {
45 + async: {
46 + chooseOne:
47 + position:
48 +
49 + },
50 + sync: {
51 + isPosition:
52 + chooseOneResults:
53 + }
54 + }
3055 }
31-scuttle.poll.async.publishChooseOne(opts, (err, poll) => {
32- if (err) throw err
3356
34- var myPosition
35- scuttle.position.async.publishPosition(myPosition, cb)
36-})
3757 ```
38-where `server` is a scuttlebot instance (or a remote connection provided by `ssb-client`)
3958
40-Note - `server` can also be an observeable which resolves to a scuttlebot instance
41-(this is more experimental, it will turn your sync functions into obs functions)
42-
43-
4459 ## Dependencies
4560
4661 Requires a scuttlebutt server with the following plugins installed:
4762 - `ssb-backlinks`
@@ -49,10 +64,10 @@
4964
5065 ## API
5166
5267 ```js
53-var Scuttle = require('scuttle-poll')
54-var scuttle = Scuttle(server)
68 +var ScuttlePoll = require('scuttle-poll')
69 +var scuttlePoll = ScuttlePoll(server)
5570 ```
5671
5772 ### Methods
5873
methods.jsView
@@ -6,9 +6,10 @@
66 chooseOne: require('./poll/async/chooseOne'),
77 get: require('./poll/async/get')
88 },
99 sync: {
10- isPoll: require('./poll/sync/isPoll')
10 + isPoll: require('./poll/sync/isPoll'),
11 + isChooseOnePoll: require('./poll/sync/isChooseOnePoll')
1112 // Poll: // this is not exported - doesn't follow the inject pattern atm
1213 }
1314 },
1415 position: {

Built with git-ssb-web