What exactly does the Polymer.flush() function do? I have used it in writing tests for a polymer component using paper-dialog. It says here in the documentation that it has to be called immediately after any dom mutations. Can anyone explain what is happening here behind scenes and some other scenarios where this function is needed?
According to the documentation located here, it says that Polymer.flush()
forces several classes of asynchronously queued tasks to flush.
So, when you do dynamic changes that affects ShadyDOM distribution or perform some async operations (like insert, append, remove) or there is dynamic DOM changes (like upgrading elements and calling attached/detached) , Polymer queues them and processes those changes.
Calling Polymer.dom.flush() ensures that these tasks complete synchronously.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With