feat: new hook `useSpeech`
Hook description
Hook for playing text using the SpeechSynthesis API.
Valid use-case for the hook
- Playing text when a component mounts.
- Playing text when a component unmounts.
- Playing text when a component receives new props.
- Playing text when a component receives new state.
- Playing text when a user clicks a button.
- Playing text when a user hovers over an element.
- Playing text when a user scrolls to a certain point on the page.
- Playing text when a user types in an input.
- Playing text when a user submits a form.
- Playing text when a user presses a key.
- Playing text when a user presses a key combination.
- Playing text when a user presses a key combination and holds it down.
Checklist
- [x] Have you read the contribution guidelines?
- [x] If you are porting a hook from
react-use, have you checked #33 and the migration guide to confirm that the hook has been approved for porting? - [x] Does the code have comments in hard-to-understand areas?
- [x] Is there an existing issue for this PR?
- https://github.com/react-hookz/web/issues/33
- [x] Have the files been linted and formatted?
- [x] Have the docs been updated?
- [x] Have you written tests for the new hook?
- [x] Have you run the tests locally to confirm they pass?
@JoeDuncko @xobotyi Please review this PR
@JoeDuncko @xobotyi Please review this PR
ill review it sometime this week
@xobotyi Any update on PR review?
@xobotyi Any update on review?
On review - no, tests - failing =)
@xobotyi Fixed test cases. You can check now.
@xobotyi Any update on this?
Codecov Report
Merging #1378 (79ab0e9) into master (c898241) will decrease coverage by
1.17%. Report is 40 commits behind head on master. The diff coverage is60.60%.
@@ Coverage Diff @@
## master #1378 +/- ##
==========================================
- Coverage 99.62% 98.46% -1.17%
==========================================
Files 62 63 +1
Lines 1072 1105 +33
Branches 169 174 +5
==========================================
+ Hits 1068 1088 +20
- Misses 2 12 +10
- Partials 2 5 +3
| Files | Coverage Δ | |
|---|---|---|
| src/index.ts | 100.00% <100.00%> (ø) |
|
| src/useSpeech/index.ts | 59.37% <59.37%> (ø) |
... and 9 files with indirect coverage changes
:mega: Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!
youi also have to add the hook to radme. otherwise - looks good
also linting is failing
@xobotyi Added hook in readme.md
I checked linting but it is not failing. Let me know by which command it is failing.
You can see linting annotations within files tab of pull request.
Linter should be run with yarn lint command
@xobotyi Fixed linting. You can check now.
you should also add tests for pausing resuming, etc. you should target 100% coverage and in this case is it easily achievable.