UNPKG

@gentrace/core

Version:
39 lines (38 loc) 1.17 kB
export default InterceptorManager; declare class InterceptorManager { handlers: any[]; /** * Add a new interceptor to the stack * * @param {Function} fulfilled The function to handle `then` for a `Promise` * @param {Function} rejected The function to handle `reject` for a `Promise` * * @return {Number} An ID used to remove interceptor later */ use(fulfilled: Function, rejected: Function, options: any): number; /** * Remove an interceptor from the stack * * @param {Number} id The ID that was returned by `use` * * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise */ eject(id: number): boolean; /** * Clear all interceptors from the stack * * @returns {void} */ clear(): void; /** * Iterate over all the registered interceptors * * This method is particularly useful for skipping over any * interceptors that may have become `null` calling `eject`. * * @param {Function} fn The function to call for each interceptor * * @returns {void} */ forEach(fn: Function): void; }