AppSdk.ts 834 Bytes
import IosAppSdk from "./IosAppSdk";
import AndroidAppSdk from "./AndroidAppSdk";
import BaseAppSdk from "./BaseAppSdk";

export class AppSdk {
    private static _instance: BaseAppSdk;
    static get I(): BaseAppSdk {
        if (!this._instance) {
            let conchConfig = window['conchConfig'];
            let os = conchConfig && conchConfig.getOS();
            switch (os) {
                case "Conch-ios":
                    this._instance = new IosAppSdk;
                    break;
                case "Conch-android":
                    this._instance = new AndroidAppSdk;
                    break;
                default:
                    this._instance = new BaseAppSdk;
                    break;
            }
            window['AppSdk'] = this._instance;
        }
        return this._instance;
    }
}