Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This pull request introduces a new Promise-based API to the i2c library, allowing for a more modern async/await workflow. The new API is non-breaking and is implemented by adding Async-suffixed methods that wrap the existing callback-based functions.

Changes:

  • Promise-based API: Added Async-suffixed methods for all async operations.
  • Refactored stream: The stream method now uses a non-blocking setInterval for better performance.
  • New Tests: Added a test suite with mocha and rewire to validate the new API.
  • Updated Documentation: The README.md has been updated with examples for the new API.
  • Dependency Management: Moved mocha to devDependencies to prevent it from being installed in production.

PR created automatically by Jules for task 1629492738254735209 started by @kelly

This commit introduces a new Promise-based API for all asynchronous
operations in the `i2c` library, providing a modern `async/await`
interface for developers.

The new API is non-breaking and is implemented by adding `Async`-suffixed
methods that wrap the existing callback-based functions.

Key changes include:
- Addition of `scanAsync`, `openAsync`, `writeAsync`, `writeByteAsync`,
  `writeBytesAsync`, `readAsync`, `readByteAsync`, and `readBytesAsync`.
- Refactoring of the `stream` method to use a non-blocking `setInterval`
  in JavaScript, improving performance.
- Addition of a new test suite using `mocha` and `rewire` to ensure the
  new API is working correctly.
- Updated `README.md` with documentation and examples for the new
  Promise-based API.
- Moved `mocha` to `devDependencies` to avoid installing it in
  production environments.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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