2.0.4 • Published 1 year ago
@types/sc-channel v2.0.4
Installation
npm install --save @types/sc-channel
Summary
This package contains type definitions for sc-channel (https://github.com/SocketCluster/sc-channel).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sc-channel.
index.d.ts
// Type definitions for sc-channel 2.0
// Project: https://github.com/SocketCluster/sc-channel
// Definitions by: Daniel Rose <https://github.com/DanielRose>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 3.7
import AsyncIterableStream = require('async-iterable-stream');
import StreamDemux = require('stream-demux');
import DemuxedConsumableStream = require('stream-demux/demuxed-consumable-stream');
declare class SCChannel<T> extends AsyncIterableStream<T> {
readonly PENDING: 'pending';
readonly SUBSCRIBED: 'subscribed';
readonly UNSUBSCRIBED: 'unsubscribed';
name: string;
client: SCChannel.Client;
state: SCChannel.ChannelState;
options: object;
constructor(name: string, client: SCChannel.Client, eventDemux: StreamDemux<T>, dataStream: AsyncIterableStream<T>);
createAsyncIterator(timeout?: number): AsyncIterableStream.AsyncIterator<T>;
listener(eventName: string): DemuxedConsumableStream<T>;
closeListener(eventName: string): void;
closeAllListeners(): void;
close(): void;
subscribe(options?: any): void;
unsubscribe(): void;
isSubscribed(includePending?: boolean): boolean;
publish(data: any): any;
}
export = SCChannel;
declare namespace SCChannel {
interface Client {
closeChannel(channelName: string): void;
getChannelState(channelName: string): ChannelState;
getChannelOptions(channelName: string): object;
subscribe(channelName: string): SCChannel<any>;
unsubscribe(channelName: string): void;
isSubscribed(channelName: string, includePending?: boolean): boolean;
publish(channelName: string, data: any): any;
}
type ChannelState = 'pending' | 'subscribed' | 'unsubscribed';
}
Additional Details
- Last updated: Fri, 09 Jul 2021 07:31:30 GMT
- Dependencies: @types/async-iterable-stream, @types/stream-demux
- Global values: none
Credits
These definitions were written by Daniel Rose.