 
       stop = ->
         spinning = false
-        clearTimeout intervalID
+        $timeout.cancel intervalID if intervalID?
 
       start = ->
         # Prevent another setTimeout

                element[0].offsetWidth <= 0
              return stop()

            intervalID = setTimeout drawFn, opts.speed
        )(true)

      if attrs.macCspinnerSpin?
        $scope.$watch attrs.macCspinnerSpin, (value) ->
          if value and not spinning
            start()
          else if not value and spinning
            stop()
      else
        start()


@param {Expr}    mac-cspinner-spin    Start or stop spinner
###

angular.module("Mac").directive "macCspinner",["$timeout", "util", ($timeout, util) ->
  restrict: "E"
  replace:  "true"
  template: """<div class="mac-cspinner"></div>"""
