Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Polymer.flush() do?

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?

like image 714
Aditibtp Avatar asked Jul 13 '26 10:07

Aditibtp


1 Answers

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.

like image 185
Ofisora Avatar answered Jul 16 '26 00:07

Ofisora



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!