mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: remove IBroadcastChannelContext export
This commit is contained in:
parent
763ed82512
commit
8ea4251bcf
@ -49,7 +49,7 @@ const getOrCreateTabId = () => {
|
|||||||
return storedTabId;
|
return storedTabId;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface IBroadcastChannelContext {
|
interface IBroadcastChannelContext {
|
||||||
subscribe: (
|
subscribe: (
|
||||||
event: `${EBCEvent}`,
|
event: `${EBCEvent}`,
|
||||||
callback: (message: BroadcastChannelData) => void,
|
callback: (message: BroadcastChannelData) => void,
|
||||||
|
|||||||
@ -8,16 +8,14 @@
|
|||||||
|
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
|
||||||
import {
|
import { useBroadcastChannel } from "@/contexts/broadcast-channel.context";
|
||||||
IBroadcastChannelContext,
|
|
||||||
useBroadcastChannel,
|
|
||||||
} from "@/contexts/broadcast-channel.context";
|
|
||||||
|
|
||||||
export const useSubscribeBroadcastChannel: IBroadcastChannelContext["subscribe"] =
|
export const useSubscribeBroadcastChannel: ReturnType<
|
||||||
(...props) => {
|
typeof useBroadcastChannel
|
||||||
|
>["subscribe"] = (...props) => {
|
||||||
const { subscribe } = useBroadcastChannel();
|
const { subscribe } = useBroadcastChannel();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
subscribe(...props);
|
subscribe(...props);
|
||||||
}, [subscribe, ...props]);
|
}, [subscribe, ...props]);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -8,17 +8,15 @@
|
|||||||
|
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
|
||||||
import {
|
import { useBroadcastChannel } from "../providers/BroadcastChannelProvider";
|
||||||
IBroadcastChannelContext,
|
|
||||||
useBroadcastChannel,
|
|
||||||
} from "../providers/BroadcastChannelProvider";
|
|
||||||
|
|
||||||
export const useSubscribeBroadcastChannel: IBroadcastChannelContext["subscribe"] =
|
export const useSubscribeBroadcastChannel: ReturnType<
|
||||||
(...props) => {
|
typeof useBroadcastChannel
|
||||||
|
>["subscribe"] = (...props) => {
|
||||||
const { subscribe } = useBroadcastChannel();
|
const { subscribe } = useBroadcastChannel();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
subscribe(...props);
|
subscribe(...props);
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [subscribe, ...props]);
|
}, [subscribe, ...props]);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -49,7 +49,7 @@ const getOrCreateTabId = () => {
|
|||||||
return storedTabId;
|
return storedTabId;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface IBroadcastChannelContext {
|
interface IBroadcastChannelContext {
|
||||||
subscribe: (
|
subscribe: (
|
||||||
event: `${EBCEvent}`,
|
event: `${EBCEvent}`,
|
||||||
callback: (message: BroadcastChannelData) => void,
|
callback: (message: BroadcastChannelData) => void,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user