Firebase update callback to detect error and sucssess

前端 未结 3 967
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-02 03:27

How do I make this call back work? I have read the documents but I just cant figure it out for some reason?

   var ref = new Firebase(\"https://xxx.firebasei         


        
3条回答
  •  忘掉有多难
    2021-01-02 03:52

    Frank's solution is perfect for your question. Another option is to use the update promise. It's particularly useful if you're doing a bunch of operations together which is often the case in Firebase.

    here's an example using a promise

    blast.update({ update: "I'm writing data" }).then(function(){
      alert("Data saved successfully.");
    }).catch(function(error) {
      alert("Data could not be saved." + error);
    });

提交回复
热议问题