SystemInfo

SystemInfo is a plain JavaScript object that contains information of the current system.

Syntax

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 real device.
   */
  readonly pixelRatio: number;

  /**
   * The platform of the current device.
   */
  readonly platform: 'Android' | 'iOS' | 'macOS' | 'pc' | 'headless';

  /**
   * The JavaScript engine currently used.
   * @note Not avaliable in lepus
   */
  readonly runtimeType: 'v8' | 'jsc' | 'quickjs';
};

Fields

engineVersion

The Lynx Engine version, in format major.minor.

E.g.: 3.2.

lynxSdkVersion

The Lynx Engine version, in format major.minor.

E.g.: 3.2.

osVersion

A string representing the current version of the operating system.

iOS
Android

systemVersion | Apple Developer Documentation

[[UIDevice currentDevice].systemVersion UTF8String]

pixelHeight

The absolute height of the available display size in pixels.

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

The absolute width of the available display size in pixels.

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

The natural scale factor associated with the screen.

iOS
Android

UIScreen | Apple Developer Documentation

const CGFloat pixelRatio = [UIScreen mainScreen].scale;

platform

The platform of the current device.

Candidate values:

  1. iOS
  2. Android
  3. macOS
  4. pc (for Windows)

runtimeType

The JavaScript engine currently used.

INFO

This is only avaliable in the background thread.

Candidate values:

  1. quickjs
  2. jsc
  3. v8

See JavaScript Environment for more details.

Compatibility

LCD tables only load in the browser

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.