Skip to content

Commit ade5fa7

Browse files
committed
feat : add plugin function
1 parent 6a69e42 commit ade5fa7

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/webpeerjs.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,10 @@ class webpeerjs{
830830
mddrs.push(mddr)
831831
this.#dialMultiaddress(mddrs)
832832
}
833+
834+
plugin(callback){
835+
callback(this)
836+
}
833837

834838

835839
/*

test/main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ void async function main() {
2828
}, 500)
2929

3030
nodeIdEl.innerHTML = node.id
31+
32+
function testplugin(callback){
33+
console.log('testplugin',callback.id)
34+
}
35+
node.plugin(testplugin)
3136

3237
const updateDiscoveredPeers = () => {
3338
discoveredPeerCountEl.innerHTML = node.IPFS.discoveredPeers.size

0 commit comments

Comments
 (0)