Web SDKv1.0.0

Kernstra.onLicenseChange()

Calls callback with each new license state; returns a function that unsubscribes. The same changes arrive as the licenseChanged event on Kernstra.events. A verdict that takes rights away — revoked, paused, fewer features, the outage grace period run out — is reported at once here but reaches only the next load (init, setLicense, or opening a document): whoever is exporting, printing or filling a form in an open document finishes. Listen here if your app should react sooner.

Kernstra.destroy() removes these subscriptions; one made before an init() refused for want of a license stays, so it sees the retry.

static methodLicensesince 1.0.0

Signature

static onLicenseChange(callback: (state: LicenseState) => void): () => void

Parameters

ParameterTypeDescription
callback(state: LicenseState) => voidCalled with each new license state.

Returns

() => void A function that unsubscribes.

Example

TypeScript
const stop = Kernstra.onLicenseChange((state) => {
  if (!state.valid) showBanner('License problem: ' + state.reason);
});
// later
stop();

More in Kernstra