Skip to content
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

WRQ-153: Add sendLS2Request to use LS2Request with a promise #3250

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

vJIYEv
Copy link
Contributor

@vJIYEv vJIYEv commented Jul 4, 2024

Checklist

  • I have read and understand the contribution guide
  • A CHANGELOG entry is included
  • At least one test case is included for this feature or bug fix
  • Documentation was added or is not needed
  • This is an API breaking change

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.send is a method to request luna call to a webos app or service.
So send method with promise is what developers need.
To provide LS2Request.send as a promise, I add a new function: sendLS2Request
sendLS2Request returns a promise which run LS2Request.send.
This promise will be resolved when send successes, and will be rejected when send fails.
So developers can use their own onSuccess and onFailure after the promise is resolved or rejected.

Additional Considerations

I tried to make a new function as a react custom hook where useEffect is combined with sendLS2Request so that developers can use it more easily.
However, I couldn't because onSuccess and onFailure functions both should be given in a component and should be in useEffect hook.
I think it's better for developers to choose use useEffect or not in a component case by case.

Links

WRQ-153

Comments

Enact-DCO-1.0-Signed-off-by: Jiye Kim ([email protected])

Copy link

codecov bot commented Jul 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.51%. Comparing base (67b7156) to head (75ab31c).

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.
📢 Have feedback on the report? Share it here.

vJIYEv added 3 commits July 8, 2024 15:30
Enact-DCO-1.0-Signed-off-by: Jiye Kim ([email protected])
Enact-DCO-1.0-Signed-off-by: Jiye Kim ([email protected])
Enact-DCO-1.0-Signed-off-by: Jiye Kim ([email protected])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant