-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat: Add visibility handling to allow proactive event flushing. #607
Merged
Conversation
This file contains 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
…launchdarkly/js-server-sdk-private into rlamb/SDK-564/visibility-state-handling
kinyoklion
commented
Oct 4, 2024
@@ -6,6 +6,8 @@ import { | |||
TypeValidators, | |||
} from '@launchdarkly/js-client-sdk-common'; | |||
|
|||
const DEFAULT_FLUSH_INTERVAL_SECONDS = 2; |
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.
Realized this wasn't in as I was testing things out.
kinyoklion
commented
Oct 4, 2024
@@ -78,7 +78,7 @@ it('should add click event listener for click goals', () => { | |||
|
|||
new GoalTracker(goals, mockOnEvent); | |||
|
|||
expect(document.addEventListener).toHaveBeenCalledWith('click', expect.any(Function)); |
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.
Consolidating adding event handlers resulted in extra parameters for options.
tanderson-ld
approved these changes
Oct 8, 2024
Merged
kinyoklion
pushed a commit
that referenced
this pull request
Oct 9, 2024
🤖 I have created a release *beep* *boop* --- <details><summary>akamai-edgeworker-sdk-common: 1.2.1</summary> ## [1.2.1](akamai-edgeworker-sdk-common-v1.2.0...akamai-edgeworker-sdk-common-v1.2.1) (2024-10-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from ^2.7.0 to ^2.8.0 </details> <details><summary>akamai-server-base-sdk: 2.1.17</summary> ## [2.1.17](akamai-server-base-sdk-v2.1.16...akamai-server-base-sdk-v2.1.17) (2024-10-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^1.2.0 to ^1.2.1 * @launchdarkly/js-server-sdk-common bumped from ^2.7.0 to ^2.8.0 </details> <details><summary>akamai-server-edgekv-sdk: 1.1.17</summary> ## [1.1.17](akamai-server-edgekv-sdk-v1.1.16...akamai-server-edgekv-sdk-v1.1.17) (2024-10-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^1.2.0 to ^1.2.1 * @launchdarkly/js-server-sdk-common bumped from ^2.7.0 to ^2.8.0 </details> <details><summary>cloudflare-server-sdk: 2.5.15</summary> ## [2.5.15](cloudflare-server-sdk-v2.5.14...cloudflare-server-sdk-v2.5.15) (2024-10-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/js-server-sdk-common-edge bumped from 2.4.0 to 2.4.1 </details> <details><summary>js-client-sdk-common: 1.9.0</summary> ## [1.9.0](js-client-sdk-common-v1.8.0...js-client-sdk-common-v1.9.0) (2024-10-09) ### Features * Add basic secure mode support for browser SDK. ([#598](#598)) ([3389983](3389983)) * Add bootstrap support. ([#600](#600)) ([4e5dbee](4e5dbee)) * Add ESM support for common and common-client (rollup) ([#604](#604)) ([8cd0cdc](8cd0cdc)) * Add support for hooks. ([#605](#605)) ([04d347b](04d347b)) * Add visibility handling to allow proactive event flushing. ([#607](#607)) ([819a311](819a311)) * adds datasource status to sdk-client ([#590](#590)) ([6f26204](6f26204)) * adds support for individual flag change listeners ([#608](#608)) ([da31436](da31436)) * Browser-SDK Automatically start streaming based on event handlers. ([#592](#592)) ([f2e5cbf](f2e5cbf)) ### Bug Fixes * Ensure client logger is always wrapped in a safe logger. ([#599](#599)) ([980e4da](980e4da)) * Use flagVersion in analytics events. ([#611](#611)) ([35fa033](35fa033)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-sdk-common bumped from 2.9.0 to 2.10.0 </details> <details><summary>js-sdk-common: 2.10.0</summary> ## [2.10.0](js-sdk-common-v2.9.0...js-sdk-common-v2.10.0) (2024-10-09) ### Features * Add ESM support for common and common-client (rollup) ([#604](#604)) ([8cd0cdc](8cd0cdc)) * Add visibility handling to allow proactive event flushing. ([#607](#607)) ([819a311](819a311)) * adds datasource status to sdk-client ([#590](#590)) ([6f26204](6f26204)) </details> <details><summary>js-server-sdk-common: 2.8.0</summary> ## [2.8.0](js-server-sdk-common-v2.7.0...js-server-sdk-common-v2.8.0) (2024-10-09) ### Features * adds datasource status to sdk-client ([#590](#590)) ([6f26204](6f26204)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-sdk-common bumped from 2.9.0 to 2.10.0 </details> <details><summary>js-server-sdk-common-edge: 2.4.1</summary> ## [2.4.1](js-server-sdk-common-edge-v2.4.0...js-server-sdk-common-edge-v2.4.1) (2024-10-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.7.0 to 2.8.0 </details> <details><summary>node-server-sdk: 9.6.1</summary> ## [9.6.1](node-server-sdk-v9.6.0...node-server-sdk-v9.6.1) (2024-10-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.7.0 to 2.8.0 </details> <details><summary>node-server-sdk-dynamodb: 6.1.23</summary> ## [6.1.23](node-server-sdk-dynamodb-v6.1.22...node-server-sdk-dynamodb-v6.1.23) (2024-10-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.6.0 to 9.6.1 * peerDependencies * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.6.1 </details> <details><summary>node-server-sdk-otel: 1.0.15</summary> ## [1.0.15](node-server-sdk-otel-v1.0.14...node-server-sdk-otel-v1.0.15) (2024-10-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.6.0 to 9.6.1 * peerDependencies * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.6.1 </details> <details><summary>node-server-sdk-redis: 4.1.23</summary> ## [4.1.23](node-server-sdk-redis-v4.1.22...node-server-sdk-redis-v4.1.23) (2024-10-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.6.0 to 9.6.1 * peerDependencies * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.6.1 </details> <details><summary>react-native-client-sdk: 10.8.0</summary> ## [10.8.0](react-native-client-sdk-v10.7.0...react-native-client-sdk-v10.8.0) (2024-10-09) ### Features * Add support for hooks. ([#605](#605)) ([04d347b](04d347b)) ### Bug Fixes * Ensure client logger is always wrapped in a safe logger. ([#599](#599)) ([980e4da](980e4da)) * Fix base64 encoding of unicode characters. ([#613](#613)) ([35ec8d1](35ec8d1)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-client-sdk-common bumped from 1.8.0 to 1.9.0 </details> <details><summary>vercel-server-sdk: 1.3.18</summary> ## [1.3.18](vercel-server-sdk-v1.3.17...vercel-server-sdk-v1.3.18) (2024-10-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 2.4.0 to 2.4.1 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Merged
kinyoklion
pushed a commit
that referenced
this pull request
Oct 10, 2024
🤖 I have created a release *beep* *boop* --- <details><summary>js-client-sdk: 0.0.1</summary> ## 0.0.1 (2024-10-10) ### Features * Add basic secure mode support for browser SDK. ([#598](#598)) ([3389983](3389983)) * Add bootstrap support. ([#600](#600)) ([4e5dbee](4e5dbee)) * Add browser info. ([#576](#576)) ([a2f4398](a2f4398)) * Add ESM support for common and common-client (rollup) ([#604](#604)) ([8cd0cdc](8cd0cdc)) * Add support for browser contract tests. ([#582](#582)) ([38f081e](38f081e)) * Add support for hooks. ([#605](#605)) ([04d347b](04d347b)) * Add support for js-client-sdk style initialization. ([53f5bb8](53f5bb8)) * Add support for localStorage for the browser platform. ([#566](#566)) ([4792391](4792391)) * Add URLs for custom events and URL filtering. ([#587](#587)) ([7131e69](7131e69)) * Add visibility handling to allow proactive event flushing. ([#607](#607)) ([819a311](819a311)) * adds datasource status to sdk-client ([#590](#590)) ([6f26204](6f26204)) * Adds support for REPORT. ([#575](#575)) ([916b724](916b724)) * Browser-SDK Automatically start streaming based on event handlers. ([#592](#592)) ([f2e5cbf](f2e5cbf)) * Implement browser crypto and encoding. ([#574](#574)) ([e763e5d](e763e5d)) * Implement goals for client-side SDKs. ([#585](#585)) ([fd38a8f](fd38a8f)) * Implement support for browser requests. ([#578](#578)) ([887548a](887548a)) * Refactor data source connection handling. ([53f5bb8](53f5bb8)) * Scaffold browser client. ([#579](#579)) ([0848ab7](0848ab7)) ### Bug Fixes * Ensure browser contract tests run during top-level build. ([#589](#589)) ([7dfb14d](7dfb14d)) * Ensure client logger is always wrapped in a safe logger. ([#599](#599)) ([980e4da](980e4da)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Additionally use the
keep-alive
setting of fetch to ensure delivery of events even when the page may be closing.Also better encapsulating browser APIs to ensure that the SDK can operate smoothly in service workers and browser extensions.
Also set browser appropriate flush interval.
Currently no testing for the state detector because of: jestjs/jest#10025
I think we need to switch to a babel based Jest setup to get things working better. So far Jest has not been a pleasant experience for ESM.