mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
19 lines
548 B
JavaScript
19 lines
548 B
JavaScript
// Navara auto-binds descriptor.update on creation but does not unregister
|
|
// that bound function when its handle is deleted. GEV's synchronous effects
|
|
// and meshes subscribe with their own callback so a parked view can be reused.
|
|
export function withFrameUpdates(Base) {
|
|
return class extends Base {
|
|
#frame = (time) => this.updateFrame(time);
|
|
|
|
onCreate() {
|
|
super.onCreate();
|
|
this.view.on('preRender', this.#frame);
|
|
}
|
|
|
|
onDestroy() {
|
|
this.view.off('preRender', this.#frame);
|
|
super.onDestroy();
|
|
}
|
|
};
|
|
}
|