oakmound / oak

A pure Go game engine
Apache License 2.0
1.52k stars 84 forks source link

Feature/persistent subscriptions #194

Closed 200sc closed 2 years ago

200sc commented 2 years ago

@Implausiblyfun , how does this interface feel? Does it meet the desired use case? It is a fairly trivial addition as written. It actually just rebinds anything persistent on a bus reset.

codecov-commenter commented 2 years ago

Codecov Report

Merging #194 (8e46e14) into master (1db3119) will decrease coverage by 0.13%. The diff coverage is 76.47%.

@@            Coverage Diff             @@
##           master     #194      +/-   ##
==========================================
- Coverage   92.83%   92.69%   -0.14%     
==========================================
  Files         141      141              
  Lines        6406     6423      +17     
==========================================
+ Hits         5947     5954       +7     
- Misses        399      409      +10     
  Partials       60       60              
Impacted Files Coverage Δ
event/handler.go 96.66% <ø> (ø)
event/bind.go 63.15% <71.42%> (+4.82%) :arrow_up:
event/bus.go 96.22% <100.00%> (+0.22%) :arrow_up:
drawLoop.go 62.26% <0.00%> (-11.33%) :arrow_down:

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Implausiblyfun commented 2 years ago

This looks pretty much exactly like what we were talking about. I think my only plausible reservation would be whether the ability to enumerate binds is something useful or in other words a way to purge some subset of binds. That being said if an implementer is adding persistent binds they likely have them enumerated somewhere anyways so its probably not the end of the world if we do not allow for too much control. Do you think there is a valid use case for single bind management (deletion) or does that seem antithetical to the whole idea of things that should exist forever

200sc commented 2 years ago

I think we keep it simple with 'you can set all of them and you can clear all of them' and wait to see if we find ourselves reaching for more-- we can always expand the api surface later to expose an unbind utility.