ユーザーが 5 分間非アクティブなときにポップアップを表示しようとしています。
timeout() {
setTimeout(() => this.openDialog(), 4000);
}
<h2 mat-dialog-title>Alert!</h2>
<mat-dialog-content class="mat-typography">
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-button mat-dialog-close>Cancel</button>
<button mat-button [mat-dialog-close]="true"cdkFocusInitial>Ok</button>
</mat-dialog-actions>
上記のコードでは、this.openDialog()
2 秒後にページを開くとダイアログが表示されます。しかし、ユーザーが5分間非アクティブになったときにポップアップを表示したい.