Commit 2973db64 authored by 邓晓峰's avatar 邓晓峰

fix: ClientImplementation add scope fn

parent 0357917a
import _typeof from "@babel/runtime/helpers/esm/typeof"; import _typeof from "@babel/runtime/helpers/esm/typeof";
import ClientImplementation from './ClientImplementation'; import ClientImplementation from './ClientImplementation';
import { ERROR } from './consts'; import { ERROR } from './consts';
import { validate } from './utils';
/* eslint-disable */ /* eslint-disable */
var Client = function Client(host, port, path, clientId) { var Client = function Client(host, port, path, clientId) {
......
...@@ -13,6 +13,8 @@ var _ClientImplementation = _interopRequireDefault(require("./ClientImplementati ...@@ -13,6 +13,8 @@ var _ClientImplementation = _interopRequireDefault(require("./ClientImplementati
var _consts = require("./consts"); var _consts = require("./consts");
var _utils = require("./utils");
/* eslint-disable */ /* eslint-disable */
var Client = function Client(host, port, path, clientId) { var Client = function Client(host, port, path, clientId) {
var uri; var uri;
...@@ -226,7 +228,7 @@ var Client = function Client(host, port, path, clientId) { ...@@ -226,7 +228,7 @@ var Client = function Client(host, port, path, clientId) {
this.connect = function (connectOptions) { this.connect = function (connectOptions) {
connectOptions = connectOptions || {}; connectOptions = connectOptions || {};
validate(connectOptions, { (0, _utils.validate)(connectOptions, {
timeout: 'number', timeout: 'number',
userName: 'string', userName: 'string',
password: 'string', password: 'string',
...@@ -348,7 +350,7 @@ var Client = function Client(host, port, path, clientId) { ...@@ -348,7 +350,7 @@ var Client = function Client(host, port, path, clientId) {
this.subscribe = function (filter, subscribeOptions) { this.subscribe = function (filter, subscribeOptions) {
if (typeof filter !== 'string' && filter.constructor !== Array) throw new Error('Invalid argument:' + filter); if (typeof filter !== 'string' && filter.constructor !== Array) throw new Error('Invalid argument:' + filter);
subscribeOptions = subscribeOptions || {}; subscribeOptions = subscribeOptions || {};
validate(subscribeOptions, { (0, _utils.validate)(subscribeOptions, {
qos: 'number', qos: 'number',
invocationContext: 'object', invocationContext: 'object',
onSuccess: 'function', onSuccess: 'function',
...@@ -392,7 +394,7 @@ var Client = function Client(host, port, path, clientId) { ...@@ -392,7 +394,7 @@ var Client = function Client(host, port, path, clientId) {
this.unsubscribe = function (filter, unsubscribeOptions) { this.unsubscribe = function (filter, unsubscribeOptions) {
if (typeof filter !== 'string' && filter.constructor !== Array) throw new Error('Invalid argument:' + filter); if (typeof filter !== 'string' && filter.constructor !== Array) throw new Error('Invalid argument:' + filter);
unsubscribeOptions = unsubscribeOptions || {}; unsubscribeOptions = unsubscribeOptions || {};
validate(unsubscribeOptions, { (0, _utils.validate)(unsubscribeOptions, {
invocationContext: 'object', invocationContext: 'object',
onSuccess: 'function', onSuccess: 'function',
onFailure: 'function', onFailure: 'function',
......
...@@ -28,6 +28,11 @@ const Timeout = function (client, timeoutSeconds, action, args) { ...@@ -28,6 +28,11 @@ const Timeout = function (client, timeoutSeconds, action, args) {
clearTimeout(this.timeout); clearTimeout(this.timeout);
}; };
}; };
const scope = function (f, scope) {
return function () {
return f.apply(scope, arguments);
};
};
/* eslint-disable */ /* eslint-disable */
const ClientImplementation = function ( const ClientImplementation = function (
uri, uri,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment