Documentation
    Preparing search index...

    Type Alias SurfaceObserver

    SurfaceObserver: (onResize: SurfaceResize) => () => void

    The §45 autoResize seam: subscribes onResize to the host's surface-size changes and returns the unsubscribe.

    A function the host supplies rather than a ResizeObserver this package constructs — the discipline PointerInput uses for PointerSurface and this class already uses for ApplicationOptions.now. four/application compiles with no DOM lib and must run in Node, in a worker, and in a headless test, so it names no DOM type; in a browser the whole adapter is five lines:

    const app = new Application({
    canvas,
    renderer: new WebglRenderer(),
    surfaceObserver: (onResize) => {
    const observer = new ResizeObserver(([entry]) => {
    const box = entry.contentRect;
    onResize(box.width, box.height, devicePixelRatio);
    });
    observer.observe(canvas);
    return () => { observer.disconnect(); };
    },
    });

    The returned function is called exactly once, by Application.dispose (§83: what the application subscribed, the application unsubscribes). It must be safe to call after the surface itself has gone.

    Type Declaration