DefinitelyTyped/types/node-redis-pubsub/index.d.ts

33 lines
1.0 KiB
TypeScript
Raw Permalink Normal View History

2018-09-17 20:41:55 +00:00
// Type definitions for node-redis-pubsub 3.0
2018-09-17 20:10:05 +00:00
// Project: https://github.com/louischatriot/node-redis-pubsub#readme
// Definitions by: Rene Keijzer <https://github.com/renekeijzer>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
2018-09-17 20:41:55 +00:00
// TypeScript Version: 2.2
2018-09-17 20:10:05 +00:00
2018-09-18 07:49:16 +00:00
import * as redis from "redis";
2018-09-17 20:10:05 +00:00
2018-09-17 20:41:55 +00:00
declare function NRP(options: object): NRP.NodeRedisPubSub;
2018-09-17 20:10:05 +00:00
declare namespace NRP {
2018-09-17 20:41:55 +00:00
function initClient(options: object): NodeRedisPubSub;
2018-09-17 20:10:05 +00:00
class NodeRedisPubSub {
2018-09-17 20:41:55 +00:00
constructor(options: object);
getRedisClient(): redis.RedisClient;
2018-09-18 07:49:16 +00:00
on(
channel: string,
handler: (data: string, channel: string) => void,
callback?: () => void
): () => void;
subscribe(
channel: string,
handler: (data: string, channel: string) => void,
callback?: () => void
): () => void;
2018-09-17 20:41:55 +00:00
emit(channel: string, message: string): void;
publish(channel: string, message: string): void;
quit(): void;
end(): void;
2018-09-17 20:10:05 +00:00
}
}
export = NRP;