We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
test
1 parent dcad772 commit ae091c8Copy full SHA for ae091c8
src/channel.ts
@@ -1,6 +1,7 @@
1
import { TSchema, TString, Type } from "@sinclair/typebox";
2
import { isString } from "radashi";
3
import { RedisKey } from "./key";
4
+import { MessageEvent } from "./subscriber";
5
import { RedisTransform } from "./transform";
6
7
/**
@@ -26,6 +27,18 @@ export class RedisChannel<
26
27
if (keys.length === 0) return this;
28
return new RedisChannel(`${this.name}:${keys.join(":")}`, this.schema);
29
}
30
+
31
+ /**
32
+ * Returns true if the event originated from this channel or a
33
+ * subchannel.
34
+ */
35
+ test(event: MessageEvent<any>): event is MessageEvent<T> {
36
+ return (
37
+ event.key === this ||
38
+ event.channel === this.name ||
39
+ event.channel.startsWith(this.name + ":")
40
+ );
41
+ }
42
43
44
0 commit comments