Skip to content

v1.2.0

Choose a tag to compare

@github-actions github-actions released this 16 Jul 05:00
· 16 commits to master since this release

Minor Changes

  • 42a4e6c: Add a methods option to registerCustomElement for exposing widget-delegating methods on the custom element.
    • What New optional methods option in registerCustomElement(options). Each entry becomes a public method on the custom element that is available as soon as the element is upgraded; when called it waits until the widget is created and then invokes the handler as handler(widget, ...args), returning its result as a promise. Method names that collide with an existing element member (lifecycle callbacks, internal helpers or native HTMLElement members) are skipped with a console.error.
    • Why It offers a declarative, encapsulated way to expose imperative methods that delegate to the widget and automatically wait for it, so callers can invoke them at any time without wiring up readiness handling themselves.
    • How Nothing.
  • 01fa8d9: Added a teardown lifecycle method as the counterpart to bootstrap.
    • New method teardown(widget) — called automatically at the end of widget.unmount(), after the unmount lifecycle step. Use it to remove event listeners or disconnect third-party integrations that were registered in bootstrap.
    • The full widget lifecycle order is now: bootstrap → load → mount → (active) → unmount → teardown
    • teardown is optional — if not defined, unmount() continues silently with no error.
    • TypeScript: added teardown? to WidgetDefinition and RequiredWidgetKeys in types.d.ts.