EandrewJones commented on code in PR #453: URL: https://github.com/apache/flagon-useralejs/pull/453#discussion_r1625916234
########## src/sendLogs.ts: ########## @@ -68,8 +68,28 @@ export function sendOnClose( config: Configuration, ): void { window.addEventListener("pagehide", function () { - if (config.on && logs.length > 0) { - navigator.sendBeacon(config.url, JSON.stringify(logs)); + if (!config.on) { + return; + } + + if (logs.length > 0) { + + const header_options: HeadersInit = new Headers() Review Comment: nit: never use snake case in JS/TS. Also, rename the variable `headers`. ########## package.json: ########## @@ -108,5 +108,8 @@ "ts-node": "^10.9.2", "typescript": "^5.4.5", "typescript-eslint": "^7.8.0" + }, + "dependencies": { + "cross-fetch": "^4.0.0" Review Comment: Why do we need this? All modern browsers now implement the fetch function natively, and we don't need a polyfill because this code never runs in Node... An important aspect of userale is that we have 0 dependencies. This is a major selling point to USG users. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org For additional commands, e-mail: notifications-h...@flagon.apache.org