UNPKG

@allgemein/http

Version:

Library for http request backend abstraction.

47 lines (46 loc) 1.11 kB
import { IHttp } from './IHttp'; import { ClassType } from '../Constants'; export declare class HttpFactory { private static __self__; static CLASSES: ClassType<IHttp>[]; static __loaded__: boolean; private adapters; private defaultAdapter; private loggerApi; /** * Method to create singleton for this class */ static $(): HttpFactory; /** * Initialize factory and default got adapter (if installed) */ static load(): HttpFactory; /** * Init factory and create an http adapter * * @param name */ static create(name?: string): IHttp; /** * Register http adapter classes, the first added adapter will be the default at startup. * * @param clazz */ register(clazz: ClassType<IHttp>): boolean; /** * Set default adapter name * * @param name */ setDefault(name: string): boolean; /** * Get default adapter name */ getDefault(): string; /** * Get an existing http adapter * * @param name */ create(name?: string): IHttp; }