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

Blocking & non-blocking APIs uniformity #342

Open
nighca opened this issue Oct 8, 2024 · 0 comments · May be fixed by #345
Open

Blocking & non-blocking APIs uniformity #342

nighca opened this issue Oct 8, 2024 · 0 comments · May be fixed by #345

Comments

@nighca
Copy link
Collaborator

nighca commented Oct 8, 2024

Goal

This is part of #337 and aimed to address

Adjustments

This issue proposes adjustments to current APIs:

  • Time-consuming operations (including animate, play, etc.) default to blocking, with non-blocking versions provided.
  • Non-blocking versions should have a "start" prefix.

Details

play

// play sound till end
func play(sound Sound)
func play(soundName string)
func play(sound Sound, options *PlayOptions)
func play(soundName string, options *PlayOptions)
// start playing sound & return immediately
func startPlay(sound Sound)
func startPlay(soundName string)
func startPlay(sound Sound, options *PlayOptions)
func startPlay(soundName string, options *PlayOptions)

animate

// play animation till end
func animate(name string)
// start playing animation & return immediately
func startAnimate(name string)

glide, step, turn, turnTo

These are considered high-level APIs, which are expected to be extended in the same way, while in the future.

broadcast

broadcast appears different because "waiting" should not be included in the "broadcast" process by default.

// do broadcast
func broadcast(msg string)
func broadcast(msg string, data interface{})
// do broadcast and wait until all activated scripts end
func broadcastAndWait(msg string)
func broadcastAndWait(msg string, data interface{})
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 a pull request may close this issue.

1 participant