git ssb

0+

mixmix / ssb-server-plugin-intro



Tree: 3b3ab2c175fa746ca82741044d6da2b08e241adb

Files: 3b3ab2c175fa746ca82741044d6da2b08e241adb / ssb-server-actual-friends.js

830 bytesRaw
1const flumeView = require('flumeview-reduce')
2const pull = require('pull-stream')
3
4module.exports = {
5 name: 'actualFriends',
6 version: '1.0.0',
7 manifest: {
8 get: 'async',
9 stream: 'source'
10 },
11 init: function (ssbServer, config) {
12 console.log('*** loading actual-friends ***')
13
14 // return {
15 // get: (cb) => cb('dogs!'),
16 // stream: pull.values([1,2,3,4,5])
17 // }
18
19 const view = ssbServer._flumeUse('actualFriends', flumeView(
20 1.0, // version
21 (acc, msg) => { //reduce
22 console.log('/')
23 return {
24 total: acc.total + 1
25 }
26 },
27 (msg) => { //map
28 return msg
29 },
30 null, //codec
31 initialState()
32 ))
33 console.log('init FlumeView', view)
34
35 return view
36 }
37}
38
39function initialState () {
40 return {
41 total: 0
42 }
43}
44
45
46

Built with git-ssb-web