   source.onerror = (e)-> console.log e.type
   source.onopen  = (e)-> console.log e.type
 
-  new View.Flatware model: flatware, el: $ 'body'
+  new FWF.View.Flatware model: flatware, el: $ 'body'
 
-class Flatware extends Backbone.Model
+window.FWF = {}
+
+class FWF.Flatware extends Backbone.Model
   reset = ->
     @workers.remove @workers.models
     @jobs.remove @jobs.models
 
   initialize: ->
-    @jobs    = new Backbone.Collection [], model: Job, comparator: (model)-> model.id
-    @workers = new Workers []
+    @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)

#= require vendor/backbone
$ ->
  source = new EventSource '/subscribe'
  window.flatware = new Flatware
  source.onmessage = (e)->
    [event, data] = JSON.parse e.data
    flatware.trigger event, data


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

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