Can't access functions in the class after including self method in ngOnInit
09:52 24 Apr 2020

sample.component.ts

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'app-sample',
  templateUrl: './sample.component.html',
  styleUrls: ['./sample.component.scss']
})
export class Sample implements OnInit {
  closeResult: string;
  focuscount:number=0;
  fcount:any;
  
  constructor(private router: Router) {
    ngOnInit() {
      let self = this;
      function final(){
      setTimeout(() => {
      self.router.navigate(['pattern']);
      }, 120000);
    }
  **Checking screen focus**  
  function onBlur() {
    document.body.className = 'blurred';
    focuscount+=focuscount
    if(this.focuscount>=3){
    console.log("Inside focuscount");
    final();

}
};
}

I am not able to access this function. I am getting error: Cannot find name 'finalclose'.

finalclose(){
  alert("closed");
 
}
}

I'm trying to redirect to pattern page when the condition is met. I'm getting type error. How can I fix it?

angular typescript