Ionic v4 - How to determine if any popup overlay exist in the page

Hi all,

My requirement is to determine if any popup or alert view exist over the ionic 4 page.Previously i had achieved this in ionic 3 .please refer below for ionic 3
[Find out if alert over active view]

Please check iborik answer in the above link. Exactly the same thing I want to be implement in ionic 4.Please suggest alternate way to achieve this.

Thanks in advance