As the fb_readRec function can read a record from any firebase path, the function gotRecord needs to process the data differently depending on the path.
Hence the code:
if (path == ?????)
I have chosen to save the user's age & sex. However, the only reason I read the user's details record is to see if they are registered to play my game and in fact I don't do anything with the user's age and sex.
As the fb_readAll function can read records from any firebase path, the function gotData needs to process the data differently depending on the path.
Hence the code:
if (path == ?????)
As the fb_writeRec function can write records to any firebase path, it needs to be able to write different data structures.
Hence, fb_writeRec writes the complete object that is passed to it as _data.
This video assumes you have:
Separated your data into different firebase paths.
Created generalised firebase read/write functions as per the screenshots above to:
a. read a firebase rec, passing path, key & where to save the data read.
b. write a firebase rec, passing path, key & object to write.
c. read all firebase recs, passing path & where to save the data read.