     status: Status.PENDING
   componentDidMount: ->
     return unless @state.status is Status.PENDING
-    loader = (callback) => @props.loader @props.src, callback
-    loadResult = @context.loadQueue
-      .enqueue loader, priority: @props.priority
-      .then @handleLoad, @handleError
-    @setState {loadResult, status: Status.LOADING}
+    if @context?.loadQueue?
+      loader = (callback) =>
+        @loadImage @props.src, callback
+      loadResult = @context.loadQueue
+        .enqueue loader, priority: @props.priority
+      @setState {loadResult}
+    else
+      @loadImage @props.src
   componentWillReceiveProps: (nextProps) ->
     if nextProps.priority? and @state?.loadResult?
       @state.loadResult.priority nextProps.priority

  displayName: 'ImageLoader'
  mixins: [LoaderMixin]
  propTypes:
    preloader: PropTypes.func
    onLoad: PropTypes.func
    onError: PropTypes.func
  getDefaultProps: -> preloader: img, loader: imageLoader
  handleLoad: (el) -> @setState status: Status.LOADED
  handleError: (error) -> @setState {error, status: Status.FAILED}
  render: ->
    switch @state.status
      when ImageLoader.Status.PENDING, ImageLoader.Status.LOADING
        @props.preloader()
      when ImageLoader.Status.ERROR
        (div className: 'error', @props.children)
      when ImageLoader.Status.LOADED
        (img
          src: @props.src
          onLoad: @props.onLoad
          onError: @props.onError
        )

React = require 'react'

{PropTypes} = React
{span, img} = React.DOM

Status =
  PENDING: 'pending'
