-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbee.js
More file actions
19 lines (18 loc) · 693 Bytes
/
bee.js
File metadata and controls
19 lines (18 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import Autobase from 'autobase'
import goodbye from './goodbye.js'
import Autodeebee from 'hyperdeebee/autodeebee.js'
export default async function createBee (sdk, topic) {
const IOCores = await sdk.namespace(topic)
const localInput = IOCores.get({ name: 'local-input' })
const localOutput = IOCores.get({ name: 'local-output' })
await Promise.all([localInput.ready(), localOutput.ready()])
const autobase = new Autobase({ inputs: [localInput], localInput, localOutput })
goodbye(async _ => {
console.log('closing bee...')
await autobase.close()
await localInput.close()
await localOutput.close()
await IOCores.close()
})
return new Autodeebee(autobase)
}