mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-26 23:30:09 +08:00
refactor(window): improve WindowProvider implementation
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
import { createContext, use } from "react";
|
||||
|
||||
export interface ChainProxyContextType {
|
||||
isChainMode: boolean;
|
||||
setChainMode: (isChain: boolean) => void;
|
||||
chainConfigData: string | null;
|
||||
setChainConfigData: (data: string | null) => void;
|
||||
}
|
||||
|
||||
export const ChainProxyContext = createContext<ChainProxyContextType | null>(
|
||||
null,
|
||||
);
|
||||
|
||||
export const useChainProxy = () => {
|
||||
const context = use(ChainProxyContext);
|
||||
if (!context) {
|
||||
throw new Error("useChainProxy must be used within a ChainProxyProvider");
|
||||
}
|
||||
return context;
|
||||
};
|
||||
Reference in New Issue
Block a user