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/lynx-api/global/system-info.md.
Lynx
  • 简体中文
  • SystemInfo

    SystemInfo 是一个普通的 JavaScript 对象,其中含有当前系统和设备的相关信息。

    语法

    declare const SystemInfo: {
      /**
       * The version of the Lynx Engine.
       *
       * @example '3.2'
       */
      readonly engineVersion: string;
    
      /**
       * The version of the Lynx Engine.
       * @example '3.2'
       * @deprecated Use `SystemInfo.engineVersion` instead
       */
      readonly lynxSdkVersion: string;
    
      /**
       * The current operating system version.
       */
      readonly osVersion: string;
    
      /**
       * The physical pixel height of the real device.
       */
      readonly pixelHeight: number;
    
      /**
       * The physical pixel width of the real device.
       */
      readonly pixelWidth: number;
    
      /**
       * The physical pixel ratio of the main screen.
       */
      readonly pixelRatio: number;
    
      /**
       * The platform of the current device.
       */
      readonly platform: 'Android' | 'iOS' | 'macOS' | 'windows' | 'headless';
    
      /**
       * The JavaScript engine currently used.
       * @note Not available in lepus
       */
      readonly runtimeType: 'v8' | 'jsc' | 'quickjs';
    };

    属性

    engineVersion

    当前 Lynx Engine 版本号,格式为 major.minor

    例如:3.2

    lynxSdkVersion

    当前 Lynx Engine 版本号,格式为 major.minor

    例如:3.2

    osVersion

    当前操作系统版本。

    iOS
    Android

    systemVersion | Apple Developer Documentation

    [[UIDevice currentDevice].systemVersion UTF8String]

    pixelHeight

    当前设备屏幕的绝对高度,以物理像素为单位。

    iOS
    Android

    UIScreen | Apple Developer Documentation

    CGSize screenSize;
    if (!CGSizeEqualToSize(builder.screenSize, CGSizeZero)) {
      screenSize = builder.screenSize;
    } else {
      screenSize = [UIScreen mainScreen].bounds.size;
    }
    const CGFloat scale = [UIScreen mainScreen].scale;
    // highlight-next-line
    const CGFloat pixelHeight = screenSize.height * scale;

    pixelWidth

    当前设备屏幕的绝对宽度,以物理像素为单位。

    iOS
    Android

    UIScreen | Apple Developer Documentation

    CGSize screenSize;
    if (!CGSizeEqualToSize(builder.screenSize, CGSizeZero)) {
      screenSize = builder.screenSize;
    } else {
      screenSize = [UIScreen mainScreen].bounds.size;
    }
    const CGFloat scale = [UIScreen mainScreen].scale;
    // highlight-next-line
    const CGFloat pixelWidth = screenSize.width * scale;
    

    pixelRatio

    当前设备的像素比例。

    iOS
    Android

    UIScreen | Apple Developer Documentation

    const CGFloat pixelRatio = [UIScreen mainScreen].scale;

    platform

    当前设备对应的平台。

    可能的值:

    1. iOS
    2. Android
    3. macOS
    4. windows

    runtimeType

    目前使用的 JavaScript 引擎。

    Info

    该值只能在后台线程获得,在主线程为 undefined

    可能的值:

    1. quickjs
    2. jsc
    3. v8

    更对细节内容见 JavaScript 环境

    兼容性

    LCD tables only load in the browser

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