Currently, I am organizing the code in my index.ts by creating simple line function definitions like:
HTTP Example
export const demoHttpApp = functions.https.onRequest(
(req, resp) => new DemoHttpClass(req, resp).run()
);
Real-Time Database Example
export const demoRtDb = functions.database.ref(DemoRtDbClass.PATH)
.onWrite(event => new DemoRtDbClass(event).run());
The concept is to develop one class at a time and test them independently.
Each class constructor returns this, allowing for easy access to class members.
I have a concern regarding potential memory leaks or other malfunctions that may occur.
Since the operations are complex, I prefer using object methods and keeping them separate from other calls.
However, I want to avoid any issues or performance impact due to errors.
My understanding is that once the function execution is complete, the reference to the object is lost and memory is freed. Can you confirm this?
Thank you!