Conversation
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.
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This pull request introduces a new Promise-based API to the
i2clibrary, allowing for a more modernasync/awaitworkflow. The new API is non-breaking and is implemented by addingAsync-suffixed methods that wrap the existing callback-based functions.Changes:
Async-suffixed methods for all async operations.stream: Thestreammethod now uses a non-blockingsetIntervalfor better performance.mochaandrewireto validate the new API.README.mdhas been updated with examples for the new API.mochatodevDependenciesto prevent it from being installed in production.PR created automatically by Jules for task 1629492738254735209 started by @kelly