max pleaner max pleaner - 8 months ago 47
Javascript Question

Firebase is not setting data with browser API

Here's the code I have to set some data:


which returns

Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}

It suggests that I can pass it a then/catch handler, but writing:

log = function(x) {console.log(x)

has the exact same effect (nothing is returned/printed either way)

The wierd thing is that this intermittently works, I just can't figure out why.


.set and .update are both thenable.

function update(node,key,value){
    var ref = firebase.database().ref('/');
    var obj = {};
    obj[key] = value;
    .then(function() {
        console.log('Update Ran Successfully');