So that you understand my question right I think I have to dive a bit deeper. I know how to solve this with vanilla Javascript, which will also work in typescript. The only problem is I don't get how to call this function in typescript throughout the app. I can't use a while(true) and I know that Javascript is single-threaded so I guess it is the same with typescript.
How can I implement a checker which checks throughout the runtime if a element is in view?