smartuniverse/ts/smartuniverse.classes.clientuniversechannel.ts

45 lines
1.1 KiB
TypeScript
Raw Normal View History

import * as plugins from './smartuniverse.plugins';
2019-04-11 15:52:01 +00:00
import * as interfaces from './interfaces';
2019-04-11 15:52:01 +00:00
import { ClientUniverse } from './';
2019-04-11 15:52:01 +00:00
export class ClientUniverseChannel implements interfaces.IUniverseChannel {
// ======
// STATIC
// ======
public static async createClientUniverseChannel(
clientUniverseArg: ClientUniverse,
2019-04-22 07:58:36 +00:00
channelName: string,
passphraseArg: string
): Promise<ClientUniverseChannel> {
2019-04-22 07:58:36 +00:00
const clientChannel = new ClientUniverseChannel(clientUniverseArg, passphraseArg);
2019-04-22 11:06:01 +00:00
await clientChannel.subscribe();
return clientChannel;
}
// ========
// INSTANCE
// ========
2019-04-22 20:04:52 +00:00
// properties
public name: string;
2019-04-22 07:58:36 +00:00
public passphrase: string;
2019-04-22 20:04:52 +00:00
// refs
public clientUniverse: ClientUniverse;
constructor(clientUniverseArg: ClientUniverse, nameArg: string, passphraseArg: string) {
this.clientUniverse = clientUniverseArg;
2019-04-22 20:04:52 +00:00
this.name = nameArg;
2019-04-22 11:06:01 +00:00
this.passphrase = passphraseArg;
}
/**
2019-04-22 11:06:01 +00:00
* subscribes to a channel
* tells the universe about this instances interest into a channel
*/
2019-04-22 11:06:01 +00:00
public async subscribe() {
this.clientUniverse.socketClient;
}
}