UNPKG

mux-fetch

Version:
24 lines (16 loc) 524 B
import { DEFAULT_CONFIG } from "./constant"; import { checkGlobalConfig, configFactory } from "./utils"; import { FetchConfig } from "./@types/"; const globalConfigMap = new Map<any, any>([["config", DEFAULT_CONFIG]]); export default globalConfigMap; export const setGlobalConfig = (config: FetchConfig = {}) => { /** * 开始前,进行必要的检查 */ checkGlobalConfig(config); /** * 对参数进行处理 */ const params = configFactory(config); globalConfigMap.set("config", params); };