I work with javascript. Let's suppose I have the following function in my app:
function verify(cats) {
if ( cats > 20 ) {
// do something
}
}
Supposing i have a button to add cats, I may use that function after every cat adding. However, i don't like this method.
I want that this function be in the background and is executed automatically when the condition states true
Is there some way to do so ?