- Updated project to use Tailwind CSS for styling. - Added new UI components including Navbar, Sidebar, Footer, Accordion, and Button. - Created markdown content page for documentation. - Improved overall structure and design of the application.
17 lines
403 B
TypeScript
17 lines
403 B
TypeScript
import { getContext, hasContext, setContext } from 'svelte';
|
|
|
|
export function createContext<T>() {
|
|
const key = Symbol();
|
|
|
|
return {
|
|
get: () => {
|
|
if (!hasContext(key)) {
|
|
throw new Error('Context was not set');
|
|
}
|
|
return getContext<T>(key);
|
|
},
|
|
set: (context: T) => {
|
|
setContext(key, context);
|
|
}
|
|
};
|
|
} |