WRQ-153: Add sendLS2Request to use LS2Request with a promise #3250
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 ([email protected])