Learning How to Listen: Automatically Finding Bug Patterns in Event-Driven JavaScript APIs