For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/react/Interface.DataProcessors.md.
  • 简体中文
  • @lynx-js/react / DataProcessors

    接口: DataProcessors

    The data processors that registered with Lynx.registerDataProcessors.

    示例

    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;
        }
      }
    })

    可索引

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

    方法

    getScreenMetricsOverride()?

    optional getScreenMetricsOverride(metrics: object): object

    Optional processor to override screen metrics used by the app

    参数

    范围类型描述
    metricsobjectThe physical screen dimensions in pixels
    metrics.heightnumberThe physical pixel height of the screen
    metrics.widthnumberThe physical pixel width of the screen

    返回

    object

    New screen dimensions to be used by the app

    height
    height: number;
    width
    width: number;

    示例

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

    定义于

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

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