I have a function called
opensnack(text) { ... };
which is opening an angular material snackbar with the given text input.
What I
Try to use setInterval
setInterval will allow to run a function regularly with the interval between the runs
https://javascript.info/settimeout-setinterval
Example:
function opensnack(text: string) : void {
console.log(text);
}
setInterval(opensnack, 10000, "my text"); <-- run every 10 second
You can look at this stackblitz example: