Files
cocos4/@types/pal/system.d.ts
T
PP 9bb4c4f8ea support pal/system (#8441)
* support pal/app

update

update

* remove 'QQ_PLAY' and 'FB_PLAYABLE_ADS'

* rename system

update

* rename Language

* update

* update

* bind function in Game.ts

* rename system

* support system.getBatteryLevel()

* support pal/system on native

* support pal/system on minigame

* update

* fix esLint

* fix Circular dependency

* fix esLint

* use math/Size
2021-04-15 11:00:54 +08:00

71 lines
2.6 KiB
TypeScript

declare module 'pal/system' {
export interface SupportCapability {
readonly webp: boolean;
readonly gl: boolean;
readonly canvas: boolean;
readonly imageBitmap: boolean;
}
class System {
public readonly networkType: import('pal/system/enum-type/network-type').NetworkType;
public readonly isNative: boolean;
public readonly isBrowser: boolean;
public readonly isMobile: boolean;
public readonly isLittleEndian: boolean;
/**
* Platform is a spacial field which is related to the build platform you choose on the Builder Panel in Cocos Creator.
* It may point to an OS like Android or iOS.
* It may point to a phone brand like vivo or OPPO.
* Also it may point to an app channel like WeChat or ByteDance.
*/
public readonly platform: import('pal/system/enum-type').Platform;
/**
* This is the language code typed as `Language`.
*/
public readonly language: import('pal/system/enum-type').Language;
/**
* This is the native value return by platform
* The valid value can be 'zh-tw','en','en-us','fr','fr-fr','es-es' and so on.
*/
public readonly nativeLanguage: string;
public readonly os: import('pal/system/enum-type').OS;
public readonly osVersion: string;
public readonly osMainVersion: number;
public readonly browserType: import('pal/system/enum-type').BrowserType;
public readonly browserVersion: string;
public readonly pixelRatio: number;
public readonly supportCapability: SupportCapability;
public getViewSize (): import('cocos/core/math').Size;
public getOrientation (): import('pal/system/enum-type').Orientation;
public getSafeAreaEdge (): SafeAreaEdge;
public getBatteryLevel (): number;
public triggerGC (): void;
public openURL (url: string): void;
public now (): number;
public restartJSVM (): void;
public onHide (cb: () => void);
public onShow (cb: () => void);
public onViewResize (cb: () => void);
public onOrientationChange (cb: () => void);
public offHide (cb?: () => void);
public offShow (cb?: () => void);
public offViewResize (cb?: () => void);
public offOrientationChange (cb?: () => void);
// TODO: support onError
}
export const system: System;
export interface SafeAreaEdge {
left: number;
right: number;
top: number;
bottom: number;
}
}