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

Add AsyncAdapter #7

Merged
merged 4 commits into from
May 9, 2023
Merged

Add AsyncAdapter #7

merged 4 commits into from
May 9, 2023

Conversation

DrJosh9000
Copy link
Owner

@DrJosh9000 DrJosh9000 commented May 5, 2023

AsyncAdapter can be used to handle events in an asynchronous manner, similar to the main Yarn Spinner implementation.AsyncAdapter is a DialogueHandler that can be passed to VirtualMachine. Then, the user can supply an AsyncDialogueHandler. Once any of the messages are called on the AsyncDialogueHandler, the VM execution is paused, and can continue by calling Go or GoWithChoice on AsyncAdapter, or can be stopped entirely with Abort.

@kalexmills
Copy link
Collaborator

This looks like it could be extremely useful to me!
I'll take a closer look later today. Let me know when it's ready for feedback, if you're interested. :)

@kalexmills
Copy link
Collaborator

API LGTM so far.

lmk if you want feedback on the implementation when it's ready and I can do a more thorough review.

Thanks for this! It's gonna be awesome. :D

AsyncAdapter can be used to handle Line, Options, and Command events in
an asynchronous manner, similar to the main Yarn Spinner implementation.
AsyncAdapter is a DialogueHandler that can be passed to VirtualMachine.
Then, the user can supply an AsyncDialogueHandler. When Line, Options,
or Command is called on the AsyncDialogueHandler, the VM execution is
paused, and can continue by calling AsyncAdapter.Go, GoWithChoice,
or can be stopped entirely with AsyncAdapter.Abort.
@DrJosh9000 DrJosh9000 marked this pull request as ready for review May 6, 2023 07:25
@DrJosh9000 DrJosh9000 changed the title WIP: AsyncAdapter Add AsyncAdapter May 6, 2023
@DrJosh9000
Copy link
Owner Author

@kalexmills have at it! Keen to hear your thoughts.

Copy link
Collaborator

@kalexmills kalexmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few questions. LGTM

async_adapter.go Show resolved Hide resolved
async_adapter.go Outdated Show resolved Hide resolved
DrJosh9000 added 3 commits May 8, 2023 05:00
Aside from consistency, pausing on other events may be useful to show animations, etc.
Copy link
Collaborator

@kalexmills kalexmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks. :D

@DrJosh9000 DrJosh9000 merged commit b3f1d56 into main May 9, 2023
@DrJosh9000 DrJosh9000 deleted the sync-handler branch May 10, 2023 10:10
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.

2 participants