Client-side runtime for interactive Wikidot elements.
bun add @wdprlib/runtime
import { initWdprRuntime } from "@wdprlib/runtime";
import type { WdprRuntime, RuntimeOptions } from "@wdprlib/runtime";
// Initialize after DOM is ready
const runtime: WdprRuntime = initWdprRuntime({
root: document.getElementById("page-content") as HTMLElement,
onRate: async (pageId, points) => {
const res = await fetch("/api/rate", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ page_id: pageId, points }),
});
return res.json();
},
});
// Cleanup when navigating away or re-rendering
runtime.destroy();
AGPL-3.0 - See LICENSE