Generic change watcher for Javascript