mirror of
https://github.com/imezx/Warp.git
synced 2025-04-25 07:30:02 +00:00
21 lines
646 B
TypeScript
21 lines
646 B
TypeScript
import { version } from "../package.json";
|
|
|
|
import { processQueue } from "./_processQueue";
|
|
import AlgoliaAnalytics from "./insights";
|
|
import { getRequesterForBrowser } from "./utils/getRequesterForBrowser";
|
|
import type { RequestFnType } from "./utils/request";
|
|
|
|
export function createInsightsClient(
|
|
requestFn: RequestFnType
|
|
): AlgoliaAnalytics {
|
|
const instance = new AlgoliaAnalytics({ requestFn });
|
|
if (typeof window === "object") {
|
|
// Process queue upon script execution
|
|
processQueue.call(instance, window);
|
|
}
|
|
|
|
instance.version = version;
|
|
return instance;
|
|
}
|
|
|
|
export default createInsightsClient(getRequesterForBrowser());
|