Comments (5)
What if you do something like:
import 'stub.dart'
if (dart.library.html) 'html_impl.dart'
if (dart.library.js_interop) 'js_interop_impl.dart';
If the evaludation is short circuited, then the html implementation should be used on old web platforms and the js_interop implementation should be used on WASM.
from sdk.
What if you do something like:
import 'stub.dart' if (dart.library.html) 'html_impl.dart' if (dart.library.js_interop) 'js_interop_impl.dart';If the evaludation is short circuited, then the html implementation should be used on old web platforms and the js_interop implementation should be used on WASM.
This could work if the condition is not running into any compile issues.
from sdk.
Potentially we could treat this as a duplicate of #55694?
cc @osa1
from sdk.
Potentially we could treat this as a duplicate of #55694?
Yes, I think this is a duplicate #55694.
from sdk.
I'll close this so we can track the idea of the new condition in the other issue.
I forgot to mention - the workaround suggested by @Rexios80 above is also what we recommend for distinguishing runtimes under the current available conditional import conditions.
dart:html
is supported in JavaScript compilers (DDC and dart2js) and not Wasm, so dart.library.html
can be used to distinguish between the various JS runtimes, similarly dart.library.js_interop
helps distinguish wasm from the VM runtime.
In the past some people have used js
and js_util
, but it's likely those will not be supported in Wasm in the future, and as such, we normally recommend using .js_interop
instead.
This could work if the condition is not running into any compile issues.
Can you clarify what's your concern? I'm not sure I follow
from sdk.
Related Issues (20)
- ffi/callback_unwind_error_test was flaky, turned Crash on vm-aot-linux-release-arm-qemu HOT 1
- Failures on Expose CommentToken as analyzer public API...[analyzer] HOT 3
- [dart2js] dart2js should do better inlining of `@Native` method stubs
- Docs on how to access and use the test status database HOT 6
- Isolate-local native callables create spurious exception in debugger when returning null HOT 3
- [breaking change] Change the context for the operand of `throw` to `Object`. HOT 10
- Create a method to know if a type is a Built-in type HOT 11
- Contradictory behavior from `body_might_complete_normally` HOT 4
- toStringAsFixed and Number format does not work correctly HOT 2
- [dart:js_interop] Add JSArray.from static method. HOT 2
- Crash while trying to find the compilation unit for an element HOT 1
- Analyzer Feedback from IntelliJ HOT 1
- dart2js memory usage output always 0
- Coverage reports differ when --optimization-counter-threshold=-1 is used HOT 6
- vm/dart/isolates/shared_test flakily fails on vm-reload-linux-release-x64 HOT 5
- Pre-built Stack Class in the Dart Standard Library HOT 2
- Data driven fix: Replacing a method with a getter when method has been removed does not work correctly
- Never-bounded types cause CFE crash
- [dartdev] `Could not find dart. Have you built the full Dart SDK?` on `dart build` HOT 10
- [infra] More frequent dev releases HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk.