-Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $window)->
+Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http)->
   # Handles syncing of current cart/order state to server
   new class Cart
     dirty: false


    saved: =>
      @dirty = false
      #$window.onBeforeUnload = null 

    unsaved: =>
      @dirty = true
      window.onBeforeUnload = ->
        "Your order hasn't been saved yet! Are you sure you want to leave this page?"

    line_items_present: =>
      @line_items.filter (li)->


    orderChanged: =>
      @unsaved()
      if @promise
        $timeout.cancel(@promise)
      @promise = $timeout @update, 1000

    update: =>
      $http.post('/orders/populate', @data()).success (data, status)=>
        @saved()
      .error (response, status)=>
