I've looked everywhere, and no place has given me a satisfactory answer; how do I just simply retrieve data from the Firebase Database when I want it? I don't want to syncronize the data, I just want to get the data when I call for it. Various attempts using once() have failed entirely, not getting me close at all. Is it even possible or is Firebase just not designed for what I'm trying to do?
EDIT: Minimal example of what I want to do:
let ref = firebase.database().ref("location1");
let intendedValue = "Data not Gathered";
ref.once("value").then( function(snapshot) {
intendedValue = snapshot.val();
});
console.log(intendedValue);
Where my firebase database has the structure:
projectFolder:
location1:
datapoint1: "dataValue1";
So you'd think this would log "dataValue1", but instead it logs "Data not Gathered" as if ref.once() never even ran.