Skip to content
blotter

API

Functions

Three small utilities exported alongside the classes.

On this page

filterTexts method

filterTexts ( texts: Text | Text[] | undefined ): Text[]

What Blotter uses to accept texts: text and texts: [a, b] alike. Anything that is not a Text is dropped with a warning.

pixelRatio method

pixelRatio ( ): number

The default for BlotterOptions.ratio. Safe to call during server rendering.

isWebGLSupported method

isWebGLSupported ( ): boolean

The Blotter constructor throws without WebGL. Ask first, and leave the real text in place when the answer is no.

if (isWebGLSupported()) {
  const blotter = new Blotter(material, { texts: text });
  blotter.forText(text)?.appendTo(el);
} else {
  el.textContent = text.value;
}