docs: function(data) {
  
          data = messages.decode(data);
  
          if (debug) {
            console.log("Received from Worker[" + workerId + "]\n" + JSON.stringify(data, null, 2));
          }
  
  
          if ('console' in data) {
            data.arguments.unshift("Worker[" + workerId + "]");
            console[data.console].apply(console, data.arguments);
          }
  
          if ('id' in data) {
            var msgid = data.id;
            var deferred = pendingMessages[msgid];
            if (deferred) {
              try {
                delete pendingMessages[msgid];
                if (data.hasOwnProperty('proxy')) {
                  var instance = proxy.buildProxy(data.proxy, this);
                  messages.addProxy(instance, data.proxy.id);
                  deferred.resolve(Object.freeze(instance));
                } else if (data.hasOwnProperty('resolve')) {
                  if (data.resolve === true) {
                    if (data.undefined === true) deferred.resolve(undefined);
                    else if (data.null === true) deferred.resolve(null);
                    else deferred.resolve(true);
                  } else {
                    deferred.resolve(data.resolve);
                  }
                } else if (data.hasOwnProperty('reject')) {
                  if (debug) console.warn("Rejected message " + msgid, data);
                  deferred.reject(data.reject);
                } else {
                  console.warn("Invalid message data " + msgid, data);
                  deferred.reject(new Error("Invalid message data"));
                }
              } catch(error) {
                deferred.reject(error);
              }
            } else {
              console.error("Unknown message ID", msgid);
            }
          }
        }