# Global

##

### Methods

#### onAllImagesLoad($elements, manageError, callback)

  Preload a list of images

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `$elements` | Array.<HTMLElement> | Array of images to preload
  `manageError` | Boolean | If true reject the promise on error (false)
  `callback` | onImageLoad_Callback | Function called on each image load ($element, eventType:string) => {}

  ##### Returns:

  - Return a standard Promise + an .off() function to cancel event
  Type
    Promise

  ##### Example

      onAllImagesLoad( $images, partialCallback, manageError ).then( () => {} )

      // To allow event cancelation, don't chain .then() directly after onAllImagesLoad
      let preload = onAllImagesLoad( $images, manageError, callback );
      preload.then( () => {} );
      ...

      preload.off();

#### onAnimationEnd($elem)

  Bind a one time animationend event on a DOM object

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `$elem` | HTMLElement |

  ##### Returns:

  - Return a standard Promise + an .off() function to cancel event
  Type
    Promise

  ##### Example

      onAnimationEnd( $elem ).then( () => {} );

      // To remove the event binding, don't chain .then() directly after onAnimationEnd:
      let animationEnd = onAnimationEnd( $element );
      animationEnd.then( () => {} );

      animationEnd.off()

#### onImageLoad($element, manageError, callback)

  Preload an image

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `$element` | HTMLElement | DOM image to preload
  `manageError` | Boolean | If true reject the promise on error (false)
  `callback` | onImageLoad_Callback | Function called on image load

  ##### Returns:

  - Return a standard Promise + an .off() function to cancel event
  Type
    Promise

  ##### Example

      onImageLoad( $image, manageError, callback ).then( () => {} )

      // To allow event cancelation, don't chain .then() directly after onImageLoad
      let preload = onImageLoad( $image, callback, manageError );
      preload.then( () => {} );
      ...

      preload.off();

#### onTransitionEnd($element)

  Bind a one time transitionend event on a DOM object

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `$element` | HTMLElement |

  ##### Returns:

  - Return a standard Promise + an .off() function to cancel event
  Type
    Promise

  ##### Example

      onTransitionEnd( $elem ).then( () => {} );

      // To remove the event binding, don't chain .then() directly after onTransitionEnd:
      let transitionEnd = onTransitionEnd( $element );
      transitionEnd.then( () => {} );

      transitionEnd.off()

#### Search results