@types/sc-channel
v2.0.4
Published
TypeScript definitions for sc-channel
Readme
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/v1.
index.d.ts
import Emitter = require("component-emitter");
declare class SCChannel extends Emitter {
readonly PENDING: "pending";
readonly SUBSCRIBED: "subscribed";
readonly UNSUBSCRIBED: "unsubscribed";
name: string;
state: SCChannel.ChannelState;
waitForAuth: boolean;
batch: boolean;
data: any;
constructor(name: string, client: SCChannel.SCClient, options?: SCChannel.SCChannelOptions);
setOptions(options?: SCChannel.SCChannelOptions): void;
getState(): SCChannel.ChannelState;
subscribe(options?: any): void;
unsubscribe(): void;
isSubscribed(includePending?: boolean): boolean;
publish(data: any, callback?: (err?: Error) => void): void;
watch(handler: SCChannel.HandlerFunction): void;
unwatch(handler?: SCChannel.HandlerFunction): void;
watchers(): SCChannel.HandlerFunction[];
destroy(): void;
}
export { SCChannel };
declare namespace SCChannel {
type ChannelState = "pending" | "subscribed" | "unsubscribed";
type HandlerFunction = (data: any) => void;
interface SCChannelOptions {
waitForAuth?: boolean | undefined;
batch?: boolean | undefined;
data?: any;
}
interface SCClient {
subscribe(channelName: string, options?: any): SCChannel;
unsubscribe(channelName: string): void;
isSubscribed(channelName: string, includePending?: boolean): boolean;
publish(channelName: string, data: any, callback?: (err?: Error) => void): void;
watch(channelName: string, handler: HandlerFunction): void;
unwatch(channelName: string, handler?: HandlerFunction): void;
watchers(channelName: string): HandlerFunction[];
destroyChannel(channelName: string): void;
}
}
Additional Details
- Last updated: Wed, 02 Sep 2026 02:15:51 GMT
- Dependencies: @types/component-emitter
Credits
These definitions were written by Daniel Rose.
