console-remote
console-remote copied to clipboard
Possibility to use in DOM-less environments (e.g, service workers)
I'm trying to use consolere from inside the Chrome extension. "Installed" it by downloading it from console.re/connector.js and importing it as a module. The background script (one of the places where I'm trying to utilize logging) in the chrome extension is service worker, and it does not have DOM. consolere fails on window-related calls (e.g., window.console where window is undefined). I don't see a general reason why DOM/window is mandatory for the execution environment. Is there a proper way to utilize the client library for such a case?
I guess even if the "window problem" could be avoided it still will not work as XMLHttpRequest is used while the background script has to use fetch. Per XMLHttpRequest specification it is removed from service workers. Is it the correct assumption or I'm doing something in a totally wrong direction?