feat: add rss widget (#760)

Co-authored-by: SeDemal <demal.sebastien@bluewin.ch>
This commit is contained in:
Manuel
2024-07-27 18:11:29 +02:00
committed by GitHub
parent 4380aa9b3e
commit 15d9327d46
23 changed files with 528 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
import { createListChannel, createQueueChannel, createSubPubChannel } from "./lib/channel";
export { createCacheChannel, createItemAndIntegrationChannel } from "./lib/channel";
export { createCacheChannel, createItemAndIntegrationChannel, createItemChannel } from "./lib/channel";
export const exampleChannel = createSubPubChannel<{ message: string }>("example");
export const pingChannel = createSubPubChannel<{ url: string; statusCode: number } | { url: string; error: string }>(

View File

@@ -163,6 +163,14 @@ export const createCacheChannel = <TData>(name: string, cacheDurationMs: number
export const createItemAndIntegrationChannel = <TData>(kind: WidgetKind, integrationId: string) => {
const channelName = `item:${kind}:integration:${integrationId}`;
return createChannelWithLatestAndEvents<TData>(channelName);
};
export const createItemChannel = <TData>(itemId: string) => {
return createChannelWithLatestAndEvents<TData>(`item:${itemId}`);
};
const createChannelWithLatestAndEvents = <TData>(channelName: string) => {
return {
subscribe: (callback: (data: TData) => void) => {
return ChannelSubscriptionTracker.subscribe(channelName, (message) => {