 @param {Expr}    mac-cspinner-spin    Start or stop spinner
 ###
 
-angular.module("Mac").directive "macCspinner",["util", (util) ->
+angular.module("Mac").directive "macCspinner",["$timeout", "util", ($timeout, util) ->
   restrict: "E"
   replace:  "true"
   template: """<div class="mac-cspinner"></div>"""


      stop = ->
        spinning = false
        clearTimeout intervalID

      start = ->
        # Prevent another setTimeout

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

            intervalID = $timeout drawFn, opts.speed, false
        )(true)

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

