WRQ-153: Add sendLS2Request to use LS2Request with a promise#3250
Open
WRQ-153: Add sendLS2Request to use LS2Request with a promise#3250
Conversation
Enact-DCO-1.0-Signed-off-by: Jiye Kim (jiye.kim@lge.com)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3250 +/- ##
========================================
Coverage 82.51% 82.51%
========================================
Files 157 157
Lines 7245 7245
Branches 1917 1917
========================================
Hits 5978 5978
Misses 995 995
Partials 272 272 ☔ View full report in Codecov by Sentry. |
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
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.
Checklist
Issue Resolved / Feature Added
webos/LS2Request provides a class for making LS2 service request.
It would be better to support the developer to request LS2 request with a promise
Resolution
LS2Request.sendis a method to request luna call to a webos app or service.So
sendmethod with promise is what developers need.To provide
LS2Request.sendas a promise, I add a new function:sendLS2RequestsendLS2Requestreturns a promise which runLS2Request.send.This promise will be resolved when
sendsuccesses, and will be rejected whensendfails.So developers can use their own
onSuccessandonFailureafter the promise is resolved or rejected.Additional Considerations
I tried to make a new function as a react custom hook where
useEffectis combined withsendLS2Requestso that developers can use it more easily.However, I couldn't because
onSuccessandonFailurefunctions both should be given in a component and should be inuseEffecthook.I think it's better for developers to choose use
useEffector not in a component case by case.Links
WRQ-153
Comments
Enact-DCO-1.0-Signed-off-by: Jiye Kim (jiye.kim@lge.com)