JS class that performs actions at a set interval