Skip to content

Commit 0933049

Browse files
committed
refactor: modularize pubsub api(ipfs-inactive#544)
1 parent e94670b commit 0933049

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/api/pubsub.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ const eos = require('end-of-stream')
66
const isNode = require('detect-node')
77
const PubsubMessageStream = require('../pubsub-message-stream')
88
const stringlistToArray = require('../stringlist-to-array')
9+
const moduleConfig = require('../module-config')
910

1011
const NotSupportedError = () => new Error('pubsub is currently not supported when run in the browser')
1112

1213
/* Public API */
13-
module.exports = (send) => {
14+
module.exports = (arg) => {
15+
const send = moduleConfig(arg)
16+
1417
/* Internal subscriptions state and functions */
1518
const ps = new EventEmitter()
1619
const subscriptions = {}

test/sub-modules.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,4 +293,12 @@ describe('submodules', () => {
293293
expect(appendData).to.be.a('function')
294294
})
295295
})
296+
297+
describe('pubsub', () => {
298+
const pubsub = require('../src/api/pubsub')
299+
300+
it('.pubsub', () => {
301+
expect(pubsub).to.be.a('function')
302+
})
303+
})
296304
})

0 commit comments

Comments
 (0)