code: function (def, debug) {
    this.id = Consumer.nextId();
    util.handleEvents(this);
    this.debug = debug;
  
    this.definition = def;
    this.mode = Provider.mode.synchronous;
    this.channels = {};
    this.iface = null;
    this.closeHandlers = {};
    this.providerCls = null;
  
    this.ifaces = {};
    this.emits = {};
  }
docs: A freedom port for a user-accessable provider.
  @class Provider
  @implements Port
  @uses handleEvents
  @param {Object} def The interface of the provider.
  @param {Debug} debug The debugger to use for logging.
  @contructor