Add off() method to Listenable event interface#23046
Conversation
There was a problem hiding this comment.
Code Coverage Summary
↑ packages.dds.tree.src.events:
Line Coverage Change: -1.68% Branch Coverage Change: 1.88%
| Metric Name | Baseline coverage | PR coverage | Coverage Diff |
|---|---|---|---|
| Branch Coverage | 91.66% | 93.54% | ↑ 1.88% |
| Line Coverage | 71.65% | 69.97% | ↓ -1.68% |
Baseline commit: e0e9c89
Baseline build: 305911
Happy Coding!!
Code coverage comparison check failed!!
More Details: Readme
- Skip This Check!!
What to do if the code coverage check fails:
-
Ideally, add more tests to increase the code coverage for the package(s) whose code-coverage regressed.
-
If a regression is causing the build to fail and is due to removal of tests, removal of code with lots of tests or any other valid reason, there is a checkbox further up in this comment that determines if the code coverage check should fail the build or not. You can check the box and trigger the build again. The test coverage analysis will still be done, but it will not fail the build if a regression is detected.
-
Unchecking the checkbox and triggering another build should go back to failing the build if a test-coverage regression is detected.
-
You can check which lines are covered or not covered by your tests with these steps:
- Go to the PR ADO build.
- Click on the link to see its published artifacts. You will see an artifact named
codeCoverageAnalysis, which you can expand to reach to a particular source file's coverage html which will show which lines are covered/not covered by your tests. - You can also run different kind of tests locally with
:coveragetests commands to find out the coverage.
There was a problem hiding this comment.
Copilot reviewed 5 out of 14 changed files in this pull request and generated no suggestions.
Files not reviewed (9)
- packages/dds/tree/api-report/tree.legacy.public.api.md: Evaluated as low risk
- packages/framework/fluid-framework/api-report/fluid-framework.public.api.md: Evaluated as low risk
- packages/dds/tree/api-report/tree.beta.api.md: Evaluated as low risk
- packages/dds/tree/api-report/tree.legacy.alpha.api.md: Evaluated as low risk
- packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md: Evaluated as low risk
- packages/dds/tree/api-report/tree.public.api.md: Evaluated as low risk
- packages/dds/tree/api-report/tree.alpha.api.md: Evaluated as low risk
- packages/framework/fluid-framework/api-report/fluid-framework.legacy.public.api.md: Evaluated as low risk
- packages/framework/fluid-framework/api-report/fluid-framework.legacy.alpha.api.md: Evaluated as low risk
Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more
jason-ha
left a comment
There was a problem hiding this comment.
Thanks for making even better test code (better examples for all)
|
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output |
⯅ @fluid-example/bundle-size-tests: +633 Bytes
Baseline commit: e0e9c89 |
Description
This exposes the
off()method on theListenableevent interface, providing an additional way to unsubscribe from events. The current way of unsubscribing, via the deregistration function returned byon(), is still supported. Having both options available is meant to give customers options without being opinionated about the best pattern, as it depends on preference and use case.To prevent the two strategies from interfering with each other, it has also been made illegal to register the same listener more than once for the same event. It is now documented as throwing an error rather than as undefined behavior.
This also adds a test for registering events with keys that are JS symbols and does some minor doc cleanup.