0.2.0 • Published 3 years ago

iscreen-config v0.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

iscreen-config

Install

npm i iscreen-config

Usage

import { ConfigHelper } from 'iscreen-config'

const configs = {
  socketUrl: 'wss://interaction-server.mofaxiao.com/ws/interaction-screen/conn?token=',
  msApiUrl: 'https://api-server.mofaxiao.com',
  vdApiUrl: 'http://api.vdyoo.cn/api/teacher',
  forceUpdate: false, // 是否覆盖 apiUrl 和 socketUrl,
  orgType: 'ms' // ms 魔法校(默认),vd 威渡
}

const configHelper = new ConfigHelper(configs)

API

export declare interface configs {
  socketUrl: string;
  msApiUrl: string;
  vdApiUrl: string;
  forceUpdate: boolean;
  orgType: string;
}

export declare class ConfigHelper {
  constructor(_configs: configs);

  public eConfig: Object;

  launchSetup(): void;
  setForceUpdate(val: boolean): void;
  setOrgType(type: string): void;
  getOrgType(): string;
  getSocketUrl(token: string): string;
  getApiUrl(type?: string): string;
  getUpdateUrl(type: string, params?: Object): string;
  autoDump(): void;
}