You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[name: string]: any// FIXME: would like to use [CabalDetails](https://github.com/cabal-club/cabal-client/blob/master/src/cabal-details.js) as the type here
31
+
}={};
32
+
client: Client;
33
+
constructor(name: string){
34
+
console.log('Server started');
35
+
this.name=name;
36
+
this.client=newClient({
37
+
config: {
38
+
dbdir: `/tmp/cabals-${this.name}`
39
+
}
40
+
});
41
+
}
42
+
testInitialize(): void{
43
+
constclient=newClient()
44
+
45
+
// the client is the interface for initializing cabals while
46
+
// cabalDetails contains all information and methods for one specific cabal
47
+
client.createCabal().then((cabalDetails)=>{
48
+
console.log('Cabal created',cabalDetails.key);
49
+
// each cabal is an event emitter
50
+
client.on('init',()=>{
51
+
console.log('Yay, I\'m ready!')
52
+
// the key is the unique identifier of this cabal
53
+
console.log('My key: '+cabalDetails.key)
54
+
})
55
+
})
56
+
}
57
+
testReceive(): void{
58
+
// we have two clients in this example, one for sending and one for recieving
0 commit comments