I dump variable "Var" on console, it shows 10, so it saves 10 while disconnect.
The problem is that the sequence of calling "on receive" event is controlled by firebase api. I am not sure it will be called instantly or later. In this case, it had been called instantly
You might have another private variable to store disconnect-save value independently.