Files
beaver-plugin-obsidian/src/shims/sonner.ts
T

19 lines
640 B
TypeScript

import { Notice } from "obsidian";
const SHORT_MS = 4000;
const LONG_MS = 8000;
function show(message: string, duration: number): Notice {
return new Notice(message, duration);
}
// ``svelte-sonner`` as the shared panel code imports it, backed by Obsidian
// notices; the esbuild resolver points the bare import here.
export const toast = {
error: (message: string) => show(`Beaver: ${message}`, LONG_MS),
info: (message: string) => show(message, SHORT_MS),
message: (message: string) => show(message, SHORT_MS),
success: (message: string) => show(message, SHORT_MS),
warning: (message: string) => show(message, LONG_MS),
};