Managing Scoped Resources in PubSub for Animation Rendering

Is it possible to publish a scoped resource on a PubSub and release the resource when all subscribers are done with it?

For more context, I'm working on a frontend app, on the animation render loop. I perform a computation on each frame, then publish the result. When everyone's done with it, I want to dispose the computation result, which was allocated in WASM land.
Was this page helpful?