-
Notifications
You must be signed in to change notification settings - Fork 19
feat: Add support for WASM. #184
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1239399
feat: Add support for WASM.
kinyoklion 9e7e11d
Remove commented out listeners
kinyoklion 129a6c4
Merge branch 'main' into rlamb/support-wasm
kinyoklion 4a91b1e
chore: Make messageEvent.data cast safer and fix Android build
abarker-launchdarkly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/common/lib/src/config/defaults/common_default_config.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/common_client/lib/src/config/defaults/default_config.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,17 @@ | ||
| import 'dart:async'; | ||
| import 'dart:html' as html; | ||
| import 'dart:js_interop'; | ||
| import 'package:web/web.dart' as web; | ||
| import 'dart:math' as math; | ||
|
|
||
| import '../launchdarkly_event_source_client.dart'; | ||
|
|
||
| import 'backoff.dart'; | ||
| import 'message_event.dart' as ld_message_event; | ||
|
|
||
| /// An [SSEClient] that uses the [html.EventSource] available on most browsers for web platform support. | ||
| /// An [SSEClient] that uses the [web.EventSource] available on most browsers for web platform support. | ||
| class HtmlSseClient implements SSEClient { | ||
| /// The underlying eventsource | ||
| html.EventSource? _eventSource; | ||
| web.EventSource? _eventSource; | ||
|
|
||
| /// This controller is for the events going to the subscribers of this client. | ||
| late final StreamController<ld_message_event.MessageEvent> | ||
|
|
@@ -53,26 +54,26 @@ class HtmlSseClient implements SSEClient { | |
| } | ||
|
|
||
| void _setupConnection() { | ||
| _eventSource = html.EventSource(_uri.toString()); | ||
| _eventSource = web.EventSource(_uri.toString()); | ||
|
|
||
| for (var eventType in _eventTypes) { | ||
| _eventSource?.addEventListener(eventType, _handleMessageEvent); | ||
| _eventSource?.addEventListener(eventType, _handleMessageEvent.toJS); | ||
| } | ||
| _eventSource?.addEventListener('error', _handleError); | ||
| _eventSource?.addEventListener('error', _handleError.toJS); | ||
| } | ||
|
|
||
| void _handleError(html.Event event) { | ||
| void _handleError(web.Event event) { | ||
| // The browser event source errors are reasonably opaque, if we could | ||
| // determine the type of condition, then this is where we would | ||
| // determine if this was a temporary or permanent failure. | ||
| restart(); | ||
| } | ||
|
|
||
| void _handleMessageEvent(html.Event event) { | ||
| void _handleMessageEvent(web.Event event) { | ||
| _activeSince = DateTime.now().millisecondsSinceEpoch; | ||
| final messageEvent = event as html.MessageEvent; | ||
| final messageEvent = event as web.MessageEvent; | ||
| final ldMessageEvent = ld_message_event.MessageEvent( | ||
| messageEvent.type, messageEvent.data, messageEvent.lastEventId); | ||
| messageEvent.type, (messageEvent.data as JSString).toDart, messageEvent.lastEventId); | ||
|
||
| _messageEventsController.sink.add(ldMessageEvent); | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file was regenerated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/flutter_client_sdk/lib/src/config/defaults/flutter_default_config.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaces
dart:html