fix(compat): add screen and device aliases (#9088)

* fix: Add old names to platform for compatibility

* Simplify code

* fix: apply changes to definitions

Co-authored-by: Igor Randjelovic <rigor789@gmail.com>
This commit is contained in:
Nathanael Anderson
2020-12-28 06:46:04 -06:00
committed by GitHub
parent ea67422fcf
commit 4204ac8308
3 changed files with 26 additions and 0 deletions

View File

@ -57,6 +57,9 @@ export class Screen {
static mainScreen = new MainScreen();
}
// This retains compatibility with NS6
export const screen = Screen;
class DeviceRef {
private _manufacturer: string;
private _model: string;
@ -145,5 +148,8 @@ class DeviceRef {
export const Device = new DeviceRef();
// This retains compatibility with NS6
export const device = Device;
export const isAndroid = global.isAndroid;
export const isIOS = global.isIOS;

View File

@ -121,7 +121,21 @@ export class Screen {
static mainScreen: ScreenMetrics;
}
/**
* An object describing general information about a display.
*
* This retains compatibility with NS6
*/
export const screen = Screen;
/**
* Gets the current device information.
*/
export const Device: IDevice;
/**
* Gets the current device information.
*
* This retains compatibility with NS6
*/
export const device = Device;

View File

@ -119,9 +119,15 @@ class MainScreen {
export const Device = new DeviceRef();
// This retains compatibility with NS6
export const device = Device;
export class Screen {
static mainScreen = new MainScreen();
}
// This retains compatibility with NS6
export const screen = Screen;
export const isAndroid = global.isAndroid;
export const isIOS = global.isIOS;