collective-soundworks / soundworks

Creative coding framework for distributed applications based on Web technologies.
http://soundworks.dev
BSD 3-Clause "New" or "Revised" License
114 stars 7 forks source link

[shared-state] await stateManager.observe(func) #51

Closed b-ma closed 1 year ago

b-ma commented 2 years ago

make stateManager.observe(func) asynchronous, resolving when the callback has been fully executed the first time.

b-ma commented 2 years ago

Problem is observe return unobserve, maybe we could rather return an Observer { promise, unobserve }

b-ma commented 1 year ago

done in v4

unobserve in the value of the resolved Promise:

const unobserve = await server.stateManager.observe([schemaName, ] callback);