src/multiplex.js
function addApi(self, apiName, api) {
  for (var name in api) {
    var fn = api[name];
    if (typeof fn === "function")
      api[name] = api[name].bind(self);
  }
  
  var tmp = null;
  api.replied = new Promise((resolve, reject) => {
    tmp = { resolve, reject };
  });
  api.replied.resolve = tmp.resolve;
  api.replied.reject = tmp.reject;
  
  self[apiName] = api;
}
function addApi(self, apiName, api) {
  for (var name in api) {
    var fn = api[name];
    if (typeof fn === "function")
      api[name] = api[name].bind(self);
  }
  
  var tmp = null;
  api.replied = new Promise((resolve, reject) => {
    tmp = { resolve, reject };
  });
  api.replied.resolve = tmp.resolve;
  api.replied.reject = tmp.reject;
  
  self[apiName] = api;
}
Used by ProxyDomain-derived classes to create an API method called apiName; the API
can have methods `send` and `reply` which are bound to `self`; a promise is created
in `api.replied` which is satisfied after the `reply` method has been called

@param self
@param apiName
@param api
@returns