posthog-js
Version:
Posthog-js allows you to automatically capture usage and send events to PostHog.
16 lines (15 loc) • 900 B
TypeScript
import { RequestWithOptions, RequestResponse } from './types';
import { jsonStringify } from '@posthog/browser-common/utils/request-utils';
export { jsonStringify };
export type TransportCallback = (response: RequestResponse, retryAfterMs?: number) => void;
export declare const SUPPORTS_REQUEST: boolean;
export declare const isPostHogXHR: (xhr: XMLHttpRequest) => boolean;
/**
* Extends a URL with additional query parameters
* @param url - The URL to extend
* @param params - The parameters to add
* @param replace - When true (default), new params overwrite existing ones with same key. When false, existing params are preserved.
* @returns The URL with extended parameters
*/
export declare const extendURLParams: (url: string, params: Record<string, any>, replace?: boolean) => string;
export declare const request: (_options: RequestWithOptions, onResponse?: TransportCallback) => void;