@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

除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。