-
Notifications
You must be signed in to change notification settings - Fork 0
Figure out which "operatingSystem" Wasm is. #4
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
Comments
This makes it seem to me that "browser" shouldn't be conflated with "operating system". Personally, when I compile to JS or Wasm, I feel I am making an explicit/conscious decision for behavior to be consistent to my code no matter what the underlying native operating system is. For example, Sometimes though, there might also be changes that I want to explicitly make based on the user's underlying operating system, to match their expectations or to explicitly interact with native APIs. So perhaps two concepts should be exposed:
|
Making "browser" not be an OS, but making The boolean feels less useful. That's harder because it requires the runtime to identify itself, it's not decidable at compile time. But if it's just a boolean, it's really just "not native". |
The current
Platform.operatingSystem
implementation in the new version of this packageuses
Platform.operatingSystem
for native and"browser"
for Web.That doesn't exhaust our platforms any more (and arguably didn't before).
When compiled to non-web JS and run on Node, it's incorrect to say that the operating system is
"browser"
, even ifdart:js
is available (which is what it's currently triggering on).But
dart:io
isn't available, so we also cannot usePlatform.operatingSystem
.With Wasm compilation, that gets more complicated, since we can have Wasm running on different operating systems and in a browser, and we can't really tell.
And running in a non-browser Wasm runtime, doesn't mean that
dart:io
is available.We should probably use
Platform.operatingSystem
fromdart:io
if it is available.If not, we should ... try to figure out whether it's a browser (use
dart:html
as signifier, or can that be wrong too, if someone embeds a Dart VM into a platform with HTML display, but which isn't a full browser?And for Wasm compiled code, we should see if there is some hint to the operating system.
The text was updated successfully, but these errors were encountered: