isOn(key, context?)
Returns Promise<boolean>. Shorthand for a boolean flag with a false fallback.
TypeScript
const on = await shoal.isOn("new-checkout", { user: { id } });variation(key, context, fallback)
Returns the flag’s value, typed from the fallback.
TypeScript
const limit = await shoal.variation("upload-limit-mb", ctx, 25); // numberdetail(key, context, fallback)
Like variation, plus the reason for the result — handy for debugging and analytics.
TypeScript
const { value, reason } = await shoal.detail("checkout-theme", ctx, "classic");
// reason: { kind: "RULE_MATCH", ruleIndex: 0 }bootstrap(keys, context)
Evaluates several flags at once and returns a plain object you can serialise into HTML for the browser SDK.
on(event, handler)
TypeScript
shoal.on("change", (keys) => console.log("updated", keys));
shoal.on("error", (err) => report(err));Events: ready, change, error.
close()
Closes the streaming connection and flushes pending analytics. Call it before a serverless function or script exits.