   # Alias for `Worker.mixin`
   mixin: (mixins) ->
     Worker.mixin mixins
+  
+  # Provide a callback to be executed in the context
+  # of a worker whenever it has finished running, but before
+  # saving its resutlts
+  on_finish: (callback) ->
+    Worker.finish_callback = callback
+  
+  # Provide a callback to be called every time the worker begings running
+  on_clear: (callback) ->
+    Worker.clear_callback = callback
 
 
 # The worker class is the context under which runner functions are run.

  
  # We're done!
  finish: (result) ->
    num_workers--
    @queue.finish @key
    if result? && !@emitted

    @emitted = false
    @search = null
    @is_async = false
    Worker.clear_callback?.apply this

  # If the caught error is from a `@for_reals`, then try to resolve
  # dependencies.
