API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classCanvasSizing

@codexo/exojs / core / stable

Strategy that decides how a canvas is sized and, where it lives in a document, how it follows its surroundings. An instance owns its own lifecycle: it is handed a CanvasSizingContext in CanvasSizing.attach and keeps whatever it needs - a `ResizeObserver`, window listeners, a host message channel - until CanvasSizing.detach releases them again. Nothing is created on its behalf, so a policy that observes nothing costs nothing. Passing no policy at all is the fixed case: the canvas is sized once to the base resolution and never tracks anything, which is why there is no built-in class for it. An instance belongs to one application at a time. `attach` is called when the application takes it, `detach` when it is replaced or the application is destroyed, and a policy must not commit through a context after its `detach`.

0
props
2
methods
0
events
Import
import { CanvasSizing } from '@codexo/exojs'

Strategy that decides how a canvas is sized and, where it lives in a document, how it follows its surroundings.

An instance owns its own lifecycle: it is handed a CanvasSizingContext in CanvasSizing.attach and keeps whatever it needs - a `ResizeObserver`, window listeners, a host message channel - until CanvasSizing.detach releases them again. Nothing is created on its behalf, so a policy that observes nothing costs nothing.

Passing no policy at all is the fixed case: the canvas is sized once to the base resolution and never tracks anything, which is why there is no built-in class for it.

An instance belongs to one application at a time. `attach` is called when the application takes it, `detach` when it is replaced or the application is destroyed, and a policy must not commit through a context after its `detach`.

Constructors1
new(): CanvasSizing
Methods2
Take ownership of context. Called once the surface exists and, for a canvas mounted through canvas.mount, once it is in the document.
detach(): void
Release everything CanvasSizing.attach created - observers, listeners, message channels - and undo any styling the policy applied itself. The CSS box committed through CanvasSizingContext.apply is not one of those: the application clears that on detach. The default implementation does nothing, which is correct for a policy that observes nothing.
Source