-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Need a way of passing undefined
to JS via dart:js
#24088
Comments
/cc @jacob314 @jmesserly - I recall we were having some discussions about this about a month ago this should be solvable by changing the dart:js library. We don't want to wrap "undefined" in the Dart side of things though, so while we can pass undefined down, I would prefer that we continue to translate undefined to null when reading it back in Dart. |
@sigmundch I agree. I think the cases where a JS api returns a value of null and undefined as different things are pretty rare. In that case you could always make a little wrapper js function which returns some other value for undefined. |
Is there any workaround for that? indexeddb Index.count() and ObjectStore.count() on IE10/11/Edge12 seems to expect an undefined key, not a null key for counting all items |
You can today create a js object which you use to represent undefined, and then wrap the functions on the js side, checking for that value and replacing it with undefined as necessary. Until we get real support I think that is the only option? |
We could add a getter to js_util called "undefined". |
FWIW, I'm fine with this. Since this is blocking people from using some major JS APIs (like Firebase, googlearchive/firebase-dart#90) right now, I think it's worth it. |
Add a default value and try/catch block around WheelEvent.delta(X/Y/Mode). html_dart2js does not throw error when deltaX/deltaY is null. So null handling is also added. Add test for null deltaX/deltaY/deltaMode because 'undefined' cannot be passed as value. dart-lang/sdk#24088 dart-lang/sdk#31515 PiperOrigin-RevId: 218253658
Add a default value and try/catch block around WheelEvent.delta(X/Y/Mode). html_dart2js does not throw error when deltaX/deltaY is null. So null handling is also added. Add test for null deltaX/deltaY/deltaMode because 'undefined' cannot be passed as value. dart-lang/sdk#24088 dart-lang/sdk#31515 PiperOrigin-RevId: 218253658
Many apis on the JS side of things treat
null
andundefined
very differently. We need a way of explicitly passingundefined
via js interop.The easiest way is probably to define a top level const variable?
The text was updated successfully, but these errors were encountered: