@liteguard/liteguard-browser
v0.6.20260405
Published
Liteguard SDK for browser runtimes. Feature guards, observability, and security response evaluated locally with zero network overhead per check
Downloads
537
Maintainers
Readme
@liteguard/liteguard-browser
- Website: liteguard.io
- Project Page: https://github.com/liteguard/liteguard
- Issues: https://github.com/liteguard/liteguard/issues/new
Liteguard for browser runtimes.
Installation
npm install @liteguard/liteguard-browserQuick Start
import { LiteguardClient } from "@liteguard/liteguard-browser";
const client = new LiteguardClient("pct-...", {
environment: "env-production",
});
await client.start();
const scope = client.createScope({ userId: "user-123", plan: "pro" });
if (scope.isOpen("payments.checkout")) {
// ...
}
await client.shutdown();Primary API
new LiteguardClient(projectClientToken, options)creates a client.await client.start()fetches the initial bundle and starts refresh and flush workers.client.createScope()creates an immutable scope.scope.isOpen()evaluates locally.scope.evaluate()returns aGuardDecisionwith the full evaluation result.scope.executeIfOpen()andscope.executeIfOpenAsync()measure guarded work.scope.startExecution()creates an execution correlation handle.scope.withProperties()andscope.withProtectedContext()derive child scopes.scope.getProperties()returns the current property bag for transport.client.flush()flushes buffered telemetry.client.shutdown()flushes and stops background work.
Notes
- Prefer explicit scopes for async browser flows.
- Evaluation is local after the initial bundle fetch.
- Unadopted guards default open and emit no signals.
License
Apache 2.0 see LICENSE.
