Inspired by the EventEmitter.