UNPKG

yg-tools

Version:

some convenient APIs and Methods for Youngon

28 lines (27 loc) 1.82 kB
import type { APIContext, IGlobalConfig } from '../types'; export default class GlobalConfig { /** * 未初始化 context 就调用方法, 给予警告 */ private warning; private config; constructor(context?: any, baseUrl?: string); mergeConfig(config: Partial<IGlobalConfig>): this; setContext<T extends IGlobalConfig['context']>(context: T): void; getContext(): APIContext<import("../types").HttpResponseOptionWrapper<import("../types").HttpResponseOption>>; setBaseUrl(baseUrl: string): void; getBaseUrl(): string; setAuthToken(authToken: string): void; getAuthToken(): string; setMPIndexPath(mpIndexPath: string): void; getMPIndexPath(): string; setMPAccountPath(mpAccountPath: string): void; getMPAccountPath(): string; setGlobalAPIErrorHandle(globalAPIErrorHandle: IGlobalConfig['globalAPIErrorHandle']): void; getGlobalAPIErrorHandle(): (msg: string, err?: any) => void; setHandleResponse(handleResponse: IGlobalConfig['handleResponse']): void; getHandleResponse(): (rs: import("../types").HttpResponseOption | import("../types").HttpResponseOptionWrapper<import("../types").HttpResponseOption>) => import("../types").HttpResponseOption; getConfig(key?: keyof IGlobalConfig): string | ((msg: string, err?: any) => void) | ((rs: import("../types").HttpResponseOption | import("../types").HttpResponseOptionWrapper<import("../types").HttpResponseOption>) => import("../types").HttpResponseOption) | APIContext<import("../types").HttpResponseOptionWrapper<import("../types").HttpResponseOption>> | IGlobalConfig<import("../types").HttpResponseOptionWrapper<import("../types").HttpResponseOption>>; useWebContext(webContext?: Partial<APIContext>): this; static createConfig(config: Partial<IGlobalConfig>): GlobalConfig; }