You should add a check for `visibilityChangeEventName` being undefined, and skip the call to `addEventListener`.  Chrome seems OK with adding an event listener to `undefined`, but the spec says eventType is required.