@lynx-js/react / DataProcessors

Interface: DataProcessors

The data processors that registered with Lynx.registerDataProcessors.

Example

Extending dataProcessors interface

import type { DataProcessors as WellKnownDataProcessors } from '@lynx-js/react';

declare module '@lynx-js/react' {
  interface DataProcessors extends WellKnownDataProcessors {
    foo(bar: string): number;
  }
}

Then you can use lynx.registerDataProcessors with types.

lynx.registerDataProcessors({
  dataProcessors: {
    foo(bar) {
      return 1;
    }
  }
})

Indexable

[processorName: string]: (...args: any[]) => any

Methods

getScreenMetricsOverride()?

optional getScreenMetricsOverride(metrics: object): object

Optional processor to override screen metrics used by the app

Parameters

ParameterTypeDescription
metricsobjectThe physical screen dimensions in pixels
metrics.heightnumberThe physical pixel height of the screen
metrics.widthnumberThe physical pixel width of the screen

Returns

object

New screen dimensions to be used by the app

height
height: number;
width
width: number;

Example

lynx.registerDataProcessors({
  dataProcessors: {
    getScreenMetricsOverride: (metrics) => {
      // Force a specific aspect ratio
      return {
        width: metrics.width,
        height: metrics.width * (16/9)
      };
    }
  }
});

Defined in

@lynx-js/react/runtime/lib/lynx-api.d.ts:212

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.