   )
 
   ###
-    Trigger actions when the loading state changes. This allows, for example,
-    styling a parent element differently while waiting for an image to
+    Trigger `action` when the loading state changes. This allows, for example,
+    styling another element differently while waiting for an image to
     finish loading.
-
-    Triggers an `imageWillLoad` action when loading begins.
-
-    Trigger an `imageDidLoad` action when loading completes.
 
     @method loadingDidChange
     @chainable


      didImageLoad = (e) ->
        $img = jQuery(@)
        $img.off('load.image-view', didImageLoad)

        #Do nothing if view instance is destroyed
        return if get(view, 'isDestroyed')

        #Do nothing if src has changed again since loading began
        current = get(view, 'src') ? ''
        loaded = $img.attr('src').substr(-(current.length))
        return unless loaded is current

        set(view, 'loading', false) if $img.prop 'complete' #exit loading state

jQuery = Ember.$
get = Ember.get
set = Ember.set
setProperties = Ember.setProperties
computed = Ember.computed
observer = Ember.observer
isBlank = Ember.isBlank

###
  `EllaImageComponent` creates an `<img>` element with load event handling
  that can be used to notify a parent object when a new source image begins and
  completes loading.

  This view can be used with Emberella's ListComponent to address a bug that
  causes the image defined by the `src` attribute of previous content to appear
  for a few moments until an updated image loads.

  @class EllaImageComponent
  @extends Ember.Component
###

EllaImageComponent = Ember.Component.extend

  _src: computed.oneWay 'src'

  ###
    Add the class name `emberella-image`.
