@narrativetrace/core-web
v0.3.0
Published
Browser runtime for NarrativeTrace: wires Web Crypto ids and re-exports the full core API
Readme
@narrativetrace/core-web
The browser runtime seam for NarrativeTrace: registers a Web Crypto id generator and re-exports all of @narrativetrace/core.
Install
pnpm add @narrativetrace/core-webUsage
Import from core-web instead of core in browser bundles. The import side-effect wires
crypto.getRandomValues as the trace/span id source; everything else is re-exported from
core, so the API is identical.
import {
NarrativeTraceConfig,
SyncNarrativeContext,
renderMarkdown,
} from "@narrativetrace/core-web";
const context = new SyncNarrativeContext(new NarrativeTraceConfig());
// ...run traced work against `context`...
console.log(renderMarkdown(context.captureTrace()));