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

show use of try block in examples. #79

Open
bsutton opened this issue Nov 23, 2024 · 0 comments
Open

show use of try block in examples. #79

bsutton opened this issue Nov 23, 2024 · 0 comments

Comments

@bsutton
Copy link

bsutton commented Nov 23, 2024

Thanks for the package.

Just some feedback on the doco.

Every example of calling enable or disable should be awaited.
Whilst technically you don't need to await them it's considered best practice to await or explicitly unawait any async calls.

The examples should also show a try block around any enable/disable calls to ensure that the disable method is called even if an exception is thrown.

await WakelockPlus.enable();
try {

/// do something and an exception might be thrown

}
finally {
/// ensure the wake lock is relased.
await WakelockPlus.disable();
}
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

No branches or pull requests

1 participant