src/execute-js-func.js
function listenerForId(id, timeout) {
  return listenToIpc(responseChannel)
    .do(([x]) => d(`Got IPC! ${x.id} === ${id}; ${JSON.stringify(x)}`))
    .filter(([receive]) => receive.id === id && id)
    .take(1)
    .mergeMap(([receive]) => {
      if (receive.error) {
        let e = new Error(receive.error.message);
        e.stack = receive.error.stack;
        return Observable.throw(e);
      }

      return Observable.of(receive.result);
    })
    .timeout(timeout);
}
function listenerForId(id, timeout) {
  return listenToIpc(responseChannel)
    .do(([x]) => d(`Got IPC! ${x.id} === ${id}; ${JSON.stringify(x)}`))
    .filter(([receive]) => receive.id === id && id)
    .take(1)
    .mergeMap(([receive]) => {
      if (receive.error) {
        let e = new Error(receive.error.message);
        e.stack = receive.error.stack;
        return Observable.throw(e);
      }

      return Observable.of(receive.result);
    })
    .timeout(timeout);
}
This method creates an Observable Promise that represents a future response
to a remoted call. It filters on ID, then cancels itself once either a
response is returned, or it times out.

@param  {Guid} id                                  The ID of the sent request
@param  {Number} timeout                           The timeout in milliseconds

@return {Observable}                               An Observable Promise
representing the result, or
an OnError with the error.

@private