It takes two functions; one is to check the state and the other is a callback to execute if the first function evaluates true. It can automatically handling deregistering functions once they are no longer needed