Skip to content
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

Make JsBackedMap.values MSIE 11 compatible #273

Merged
merged 1 commit into from
Aug 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/react_client/js_backed_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class JsBackedMap extends MapBase<dynamic, dynamic> {

// Private helpers with narrower typing than we want to expose, for use in other methods
List<dynamic> get _keys => _Object.keys(jsObject);
List<dynamic> get _values => _Object.values(jsObject);
// Use keys to access the value instead oof `Object.values` since MSIE 11 doesn't support it
List<dynamic> get _values => _keys.map((key) => this[key]).toList();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see us eventually polyfill Object.values on the JS side so that this can be potentially more optimized in browsers that support it, but this is totally fine for now


/// Adds all key/value pairs of the JS object [jsOther] to this map.
///
Expand Down