import { MatDialogRef } from '@angular/material/dialog' ; export function addOpenedListener ( dialog , listener ) { let opened = false ; dialog . afterOpened ( ) . subscribe ( { complete : ( ) => { if ( ! opened ) { opened = true ; listener ( ) ; } } } ) ; setTimeout ( ( ) => { if ( ! opened ) { opened = true ; listener ( ) ; } } , 1000 ) ; }