-
Notifications
You must be signed in to change notification settings - Fork 6
Support observing promises in tasks #67
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
base: master
Are you sure you want to change the base?
Conversation
|
Hey there! I just built a new temporary npm package based on 3c2e08f. You can download it here or install it by running the following command: npm install https://github.com/rokucommunity/promises/releases/download/v0.0.0-packages/rokucommunity-promises-0.6.7-65-support-observing-promises-in-tasks.20251209172634.tgz |
|
Hey there! I just built a new temporary npm package based on a9e1006. You can download it here or install it by running the following command: npm install https://github.com/rokucommunity/promises/releases/download/v0.0.0-packages/rokucommunity-promises-0.6.7-65-support-observing-promises-in-tasks.20251209183439.tgz |
|
Hey there! I just built a new temporary npm package based on 94815bf. You can download it here or install it by running the following command: npm install https://github.com/rokucommunity/promises/releases/download/v0.0.0-packages/rokucommunity-promises-0.6.7-65-support-observing-promises-in-tasks.20251215174815.tgz |
|
Hey there! I just built a new temporary npm package based on 7692e40. You can download it here or install it by running the following command: npm install https://github.com/rokucommunity/promises/releases/download/v0.0.0-packages/rokucommunity-promises-0.6.7-65-support-observing-promises-in-tasks.20251216203205.tgz |
|
Hey there! I just built a new temporary npm package based on a826f2b. You can download it here or install it by running the following command: npm install https://github.com/rokucommunity/promises/releases/download/v0.0.0-packages/rokucommunity-promises-0.6.7-65-support-observing-promises-in-tasks.20251216203632.tgz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for running promises within Roku Task nodes by introducing an event loop mechanism that allows tasks to observe and handle promise state changes through message ports.
Key Changes
- Added
runEventLoopandinitTaskFunctionalityfunctions to enable promise support in tasks - Modified promise observation logic to conditionally use message ports in task contexts
- Added test cases demonstrating promise usage in tasks with various scenarios
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/source/promises.bs | Core implementation adding task event loop and conditional observation logic |
| src/source/promises.spec.bs | Reformatted indentation (tabs to spaces) and added three task-based test cases |
| src/components/TestTask.spec.xml | New task component definition for testing promise functionality |
| src/components/TestTask.spec.bs | Task implementation with test methods for promise resolution, network calls, and rejection |
| package.json & package-lock.json | Updated brighterscript dependency from 0.69.10 to 0.69.11 |
| demos/simple-brightscript/* | Added demo task component and updated MainScene to demonstrate task usage |
| bsconfig.tests.json & .vscode/settings.json | Minor configuration updates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| while true | ||
| message = wait(0, hostPort) | ||
| if message = invalid then continue while | ||
|
|
||
| if promises.isPromiseEvent(message) then | ||
| promises.internal.notifyListeners(message) | ||
| else | ||
| if context = invalid then | ||
| callback(message) | ||
| else | ||
| callback(message, context) | ||
| end if | ||
| end if | ||
| end while |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The infinite loop in runEventLoop has no exit condition, which means tasks using this function cannot cleanly terminate. Consider adding a mechanism to break the loop, such as checking for a specific message type or a boolean flag that can be set to terminate the event loop gracefully.
demos/simple-brightscript/components/TaskWithInternalPromises.bs
Outdated
Show resolved
Hide resolved
|
Hey there! I just built a new temporary npm package based on ec7b3e9. You can download it here or install it by running the following command: npm install https://github.com/rokucommunity/promises/releases/download/v0.0.0-packages/rokucommunity-promises-0.6.7-65-support-observing-promises-in-tasks.20251218134602.tgz |
|
Hey there! I just built a new temporary npm package based on 6f99082. You can download it here or install it by running the following command: npm install https://github.com/rokucommunity/promises/releases/download/v0.0.0-packages/rokucommunity-promises-0.6.7-65-support-observing-promises-in-tasks.20251219115730.tgz |
|
Hey there! I just built a new temporary npm package based on 0b0273f. You can download it here or install it by running the following command: npm install https://github.com/rokucommunity/promises/releases/download/v0.0.0-packages/rokucommunity-promises-0.6.7-65-support-observing-promises-in-tasks.20251219135928.tgz |
|
Hey there! I just built a new temporary npm package based on e359c47. You can download it here or install it by running the following command: npm install https://github.com/rokucommunity/promises/releases/download/v0.0.0-packages/rokucommunity-promises-0.6.7-65-support-observing-promises-in-tasks.20251219144557.tgz |
No description provided.