患者1.2
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { ITUIGlobal } from '../interface/ITUIGlobal';
|
||||
export default class TUIGlobal implements ITUIGlobal {
|
||||
static instance: TUIGlobal;
|
||||
global: any;
|
||||
isPC: boolean;
|
||||
isH5: boolean;
|
||||
isWeChat: boolean;
|
||||
isApp: boolean;
|
||||
isUniPlatform: boolean;
|
||||
isOfficial: boolean;
|
||||
isWIN: boolean;
|
||||
isMAC: boolean;
|
||||
constructor();
|
||||
/**
|
||||
* 获取 TUIGlobal 实例
|
||||
* @returns {TUIGlobal}
|
||||
*/
|
||||
static getInstance(): TUIGlobal;
|
||||
initEnv(): void;
|
||||
initOfficial(SDKAppID: number): void;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const env_1 = require("../utils/env");
|
||||
class TUIGlobal {
|
||||
constructor() {
|
||||
this.global = env_1.APP_NAMESPACE;
|
||||
this.isPC = false;
|
||||
this.isH5 = false;
|
||||
this.isWeChat = false;
|
||||
this.isApp = false;
|
||||
this.isUniPlatform = false;
|
||||
this.isOfficial = false;
|
||||
this.isWIN = false;
|
||||
this.isMAC = false;
|
||||
this.initEnv();
|
||||
}
|
||||
/**
|
||||
* 获取 TUIGlobal 实例
|
||||
* @returns {TUIGlobal}
|
||||
*/
|
||||
static getInstance() {
|
||||
if (!TUIGlobal.instance) {
|
||||
TUIGlobal.instance = new TUIGlobal();
|
||||
}
|
||||
return TUIGlobal.instance;
|
||||
}
|
||||
initEnv() {
|
||||
this.isPC = env_1.IS_PC;
|
||||
this.isH5 = env_1.IS_H5;
|
||||
this.isWeChat = env_1.IN_WX_MINI_APP;
|
||||
this.isApp = env_1.IN_UNI_NATIVE_APP && !env_1.IN_WX_MINI_APP; // uniApp 打包小程序时 IN_UNI_NATIVE_APP 为 true,所以此处需要增加条件
|
||||
this.isUniPlatform = env_1.IN_UNI_APP;
|
||||
this.isWIN = env_1.IS_WIN;
|
||||
this.isMAC = env_1.IS_MAC;
|
||||
}
|
||||
initOfficial(SDKAppID) {
|
||||
this.isOfficial = (SDKAppID === 1400187352 || SDKAppID === 1400188366);
|
||||
}
|
||||
}
|
||||
exports.default = TUIGlobal;
|
||||
Reference in New Issue
Block a user