Initial commit
This commit is contained in:
commit
2f5e10140c
133 changed files with 10429 additions and 0 deletions
26
packages/notifications/src/context.tsx
Normal file
26
packages/notifications/src/context.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { createContext, useContext } from "solid-js";
|
||||
import type { ParentProps } from "solid-js";
|
||||
|
||||
export const context = createContext<contextType>();
|
||||
|
||||
export default function Provider(props: ParentProps) {
|
||||
// live_messages
|
||||
|
||||
return (
|
||||
<context.Provider value={{ test: () => {} }}>
|
||||
{props.children}
|
||||
</context.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
type contextType = {
|
||||
test: () => void;
|
||||
};
|
||||
|
||||
export function useNotifications(): contextType {
|
||||
const ctx = useContext(context);
|
||||
if (!ctx) {
|
||||
throw new Error("useNotifications must be used within a ChatProvider");
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
Loading…
Reference in a new issue