每当您在页面上处于非活动状态时,我都需要暂停.让我们说你在页面上20秒没有点击它会将你重定向到主屏幕.
当前代码不适用于不活动,我不知道如何使其工作.
ngOnInit() {
// do init at here for current route.
setTimeout((router: Router) => {
this.router.navigate(['nextRoute']);
}, 20000); //20s
Run Code Online (Sandbox Code Playgroud)
}