Files
memecoin-botV2/.pnpm-store/v10/files/72/c97483410dac919a3e365d43dde59d250fcd36a39c0b2051fd9c9144f697fa1d81e36a8fc3f6fa5907b5608eeb5149433504b103f6949764e3be06d3a48a3b

29 lines
969 B
Plaintext

'use strict';
const ClientBrowser = require('../../../../lib/client/browser/index');
const promiseUtils = require('../../utils');
/**
* Constructor for a Jayson Promise Browser Client that does not depend any node.js core libraries
* @class PromiseClientBrowser
* @extends ClientBrowser
* @return {PromiseClientBrowser}
*/
const PromiseClientBrowser = function(callServerPromise, options) {
if(!(this instanceof PromiseClientBrowser)) {
return new PromiseClientBrowser(callServerPromise, options);
}
const callServer = function (request, callback) {
callServerPromise(request).then(res => callback(null, res), err => callback(err));
};
ClientBrowser.call(this, callServer, options);
this.request = promiseUtils.wrapClientRequestMethod(this.request.bind(this));
};
// let's hope this ancient method of inheriting works the way I remember it.
PromiseClientBrowser.prototype = ClientBrowser.prototype;
module.exports = PromiseClientBrowser;