Treat ownership as part of the API
Every subscription, native resource and long-lived model needs an owner. A shared document can outlive its view; an ephemeral editor should not keep a background stream alive after navigation.
Reactive subscriptions
const subscription = cache.connect().pipe(
filter(predicate$),
bind(render)
).subscribe();
// On teardown, in owner order:
subscription.unsubscribe();
predicate$.complete();
cache.dispose();Native graphics
Use try/finally around owned Skia paints, paths, images and surfaces. A JavaScript object becoming unreachable is not a promise of immediate native memory release.
const paint = new S.SKPaint({ IsAntialias: true });
try {
surface.Canvas.DrawCircle(80, 80, 40, paint);
} finally {
paint.Dispose();
}Borrowed models
A DrawingControl does not dispose a supplied engine. Release the control first, then the application-owned engine when no other consumer needs it. Dockyard can retain DOM content while moving it, so a pane move is not an application teardown.
Playground lifetimes
Each run creates a fresh sandboxed frame. Old frames, event loops and documents are discarded. In a production application, implement the library’s documented disposal contract instead of relying on whole-page replacement.
Component APIs and compatibility boundaries are documented in their upstream repositories. Each component page links to its own source and guide.
Put it into practice