-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a global Navigator object #39540
Comments
I'm +1 on adding the navigator object, with APIs that make sense for Node.js. |
Add the Navigator object with the Device Memory API. Refs: nodejs#39540 Refs: https://html.spec.whatwg.org/multipage/system-state.html#the-navigator-object Refs: https://w3c.github.io/device-memory
Add the Navigator object with the Device Memory API. Refs: nodejs#39540 Refs: https://html.spec.whatwg.org/multipage/system-state.html#the-navigator-object Refs: https://w3c.github.io/device-memory
Add the Navigator object with the Device Memory API. Refs: nodejs#39540 Refs: https://html.spec.whatwg.org/multipage/system-state.html#the-navigator-object Refs: https://w3c.github.io/device-memory Co-authored-by: Voltrex <[email protected]>
Refs: #39581 (comment)
Refs: #39581 (comment)
I am curious what a potential use case for this could be in Node.js. The use cases for browsers are outlined in the introductory section of the specification. But what about Node.js? If I run one process on a machine with 256 MiB main memory ( (Also, the primary aspect of the spec appears to be the header field that is sent by the browser: This document defines a HTTP Client Hint header to surface device capability for memory i.e. device RAM, in order to enable web apps to customize content depending on device memory constraints.)
Interesting. So as long as the server has any network interfaces that aren't down (e.g., a virtual network switch connecting Docker containers on the same machine with no external networking capabilities), this property would be
I think the more interesting question is: what if there are two GPS sensors, each returning different locations? That being said, some operating systems do provide geolocations even without GPS hardware, so we could implement this as "if provided by the operating system in an unambiguous manner, we'll just accept it, and if it isn't, we don't support it."
We surely can add |
The biggest reasons why i want to have a Navigator object is:
I also worked with
I kind of investigated how Google dose geolocation without gps using ip and wifi access points / mac addresses at some point and thought about impl it as a npm module at some point in my life
There are ppl building Drones with NodeJS. NodeJS is more than just a server 😉 ...Language would be useful with localization and Intl |
Yes, and that's good but by itself is not enough to justify adding to core. The parts of the web platform API that we have adopted so far are bits that a) already overlap with existing core functions or b) are generally usable in all use cases, server or otherwise. Much of the navigator api is very specific to individual types of use cases that do not necessarily meet both of those criteria. I don't think anyone here is saying no outright, that would be silly, but we do need to be selective and deliberate. |
I believe @addaleax or @jasnell did some work around permission-based security models for Node.js. One of the main problems is that any permission system would make it entirely impossible to use native addons in Node.js because we cannot reasonably restrict their permissions. Also, how would we determine if a permission was granted or not? We surely cannot implement
I don't think Node.js implements any of the "storage endpoints" that would be affected by
The draft does seem to require these three functions to have any use: window.showOpenFilePicker
window.showSaveFilePicker
window.showDirectoryPicker I don't see how any of these could be implemented in Node.js.
Regardless of whether it is a good idea to build flying objects based on software that relies on dynamic memory allocations and crashes when it runs out of memory and that is incredibly difficult to statically analyze, I am not saying that there are no applications that won't benefit from geolocation. But are those few applications worth adding geolocation to Node.js core? |
Not really, you could take advantage of the sandboxed filesystem and use it without dialogs.
I know there have been talks about getting a blob backed up by the file system and i hope it will land so we can upload large file with FormData, creating objectURLs for worker threads and transfering files with very little cost. This would be the most "correct" way to obtain a File from the filesystem. With my File System Adapter I created a way to obtain a a Handle by doing something like const handle = await getOriginPrivateDirectory(nodeAdapter, './public') |
Deno has a permission api on it's Deno namespace... https://deno.land/manual/runtime/permission_apis with some degree of cli prompts |
Oh sure, we can always do that, but then the code isn't really runtime-agnostic because it requires APIs specific to a certain runtime to retrieve file handles.
We could implement something like that, but, when enabled, it would make it impossible for applications to use the |
Oh, btw browser has something new on drag and drop'ed files & folders |
Recently, WinterCG was launched to promote runtimes supporting an unified API regardless of the runtime they are using: be it browsers, servers, embedded applications, or edge runtimes. The WinterCG's Minimum Common Web Platform API proposal includes navigator.userAgent Cloudflare Workers and Deno also has a navigator.userAgent API. If this API is implemented, Node.js improve compatibility with them and web. If you are interested in implementing it, I would like to work on it! How do you think? ref #43155 |
I'm still somewhat concerned that there might be code that checks That being said, once the proposal matures and if this doesn't turn into a slippery slide that leads to other |
@tniessen Was it ever added? |
You can set up global object with custom library via API https://nodejs.org/dist/latest-v16.x/docs/api/esm.html#globalpreload |
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
example of current values for Cloudflare Workers: |
bun currently implements:
|
how do you feel about https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-UA |
For anyone else who missed this (like I did), |
Could someone kindly add |
Noting here also that |
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the
never-stale
|
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment. For more information on how the project manages feature requests, please consult the feature request management document. |
I think there is a bunch of interesting web related things on the navigator object itself that could fit into NodeJS and dose not require a UI.
Deno, Bun.js, Browser and all Worker threads has it. NodeJS is the only platform that lacks it
Things i find interesting to also have in a NodeJS environment is
(not saying we should go ahead and implement all of this)
I think there should at least exist a global navigator object so ppl can at least polyfill missing features onto the global navigator
The text was updated successfully, but these errors were encountered: