git ssb

0+

Piet / ssb-loomio



Commit 9144ab97554ad603dd57ff8d50d81940ac397cc6

Merge pull request #17 from ssbc/tidy-readme

Tidy readme
Piet Geursen authored on 3/12/2018, 2:06:39 AM
GitHub committed on 3/12/2018, 2:06:39 AM
Parent: d2a8bebd8082181882ad9ee29e93d8df75abcb15
Parent: 8fafd9587402e63cb6f4a6e1dbc10135ec69b4f7

Files changed

README.mdchanged
methods.jschanged
README.mdView
@@ -9,39 +9,53 @@
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
18-```
19-
20-```js
21-var scuttle = require('scuttle-poll')(server)
22-
23-var opts = {
24- title: 'where shall we have our community meeting?'
25- choices: [
26- 'in person',
27- 'talky.io',
28- 'mumble',
29- ]
30-}
31-scuttle.poll.async.publishChooseOne(opts, (err, poll) => {
32- if (err) throw err
33-
34- var myPosition
35- scuttle.position.async.publishPosition(myPosition, cb)
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)
3622 })
3723 ```
3824 where `server` is a scuttlebot instance (or a remote connection provided by `ssb-client`)
3925
4026 Note - `server` can also be an observeable which resolves to a scuttlebot instance
4127 (this is more experimental, it will turn your sync functions into obs functions)
4228
29 +This returns an object with methods defined in `methods.js` that looks like:
4330
31 +```js
32 +{
33 + poll: {
34 + async: {
35 + chooseOne:
36 + get:
37 + },
38 + sync: {
39 + isPoll:
40 + isChooseOnePoll:
41 + }
42 + },
43 + position: {
44 + async: {
45 + chooseOne:
46 + position:
47 +
48 + },
49 + sync: {
50 + isPosition:
51 + chooseOneResults:
52 + }
53 + }
54 +}
55 +
56 +```
57 +
4458 ## Dependencies
4559
4660 Requires a scuttlebutt server with the following plugins installed:
4761 - `ssb-backlinks`
@@ -49,10 +63,10 @@
4963
5064 ## API
5165
5266 ```js
53-var Scuttle = require('scuttle-poll')
54-var scuttle = Scuttle(server)
67 +var ScuttlePoll = require('scuttle-poll')
68 +var scuttlePoll = ScuttlePoll(server)
5569 ```
5670
5771 ### Methods
5872
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