       @trigger 'assigned', worker, job if job
       @set dots: []
 
-class Workers extends Backbone.Collection
-  model: Worker
+class FWF.Workers extends Backbone.Collection
+  model: FWF.Worker
   initialize: ->
     @on 'add', @sort
   comparator: (model)-> model.id
 
-View = {}
+View = FWF.View = {}
 
 class View.Job extends Backbone.View
   tagName: 'li'


    # @on 'all', -> console.log arguments

class Job extends Backbone.Model
  defaults:
    status: 'waiting'
    dots: []

  source.onerror = (e)-> console.log e.type
  source.onopen  = (e)-> console.log e.type

  new FWF.View.Flatware model: flatware, el: $ 'body'

window.FWF = {}

class FWF.Flatware extends Backbone.Model
  reset = ->
    @workers.remove @workers.models
    @jobs.remove @jobs.models

  initialize: ->
    @jobs    = new Backbone.Collection [], model: FWF.Job, comparator: (model)-> model.id
    @workers = new FWF.Workers []
    @on 'jobs', (jobs)=>
      reset.apply this
      @jobs.set jobs

    @on 'started', (work)=>
      {worker, job} = work
      worker = @workers.add(id: worker).get(worker)
