function bindEvents(element, resolveEventName, rejectEventName) {
  element.eventPromise =
      bindEvents2(element, resolveEventName, element, rejectEventName);
}
Binds to success and error events of an object wrapping them into a promise
    available through {@code element.eventPromise}. The success event
    resolves and error event rejects.
This method adds event listeners, and then removes all the added listeners
when one of listened event is fired.
@param {object} element An object supporting events on which to bind the
    promise.
@param {string} resolveEventName [="load"] The event name to bind resolve to.
@param {string} rejectEventName [="error"] The event name to bind reject to.