code: function maybeTriggerImageLoad(image, event) {
    if (!image.getAttribute('data-loaded') && isElementVisible(image)) {
      image.dispatchEvent(event);
  
      return true;
    }
  
    return false;
  }
docs: Check if an image is visible and trigger an event if so.
  @param  {Element} image the image to check
  @param  {Event}   event an event to dispatch if the image is in the viewport
  @return {Boolean}       true if the image is in the viewport; false if not