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

fix: ClientImplementation add scope fn

parent 0357917a
import _typeof from "@babel/runtime/helpers/esm/typeof";
import ClientImplementation from './ClientImplementation';
import { ERROR } from './consts';
import { validate } from './utils';
/* eslint-disable */
var Client = function Client(host, port, path, clientId) {
......
......@@ -13,6 +13,8 @@ var _ClientImplementation = _interopRequireDefault(require("./ClientImplementati
var _consts = require("./consts");
var _utils = require("./utils");
/* eslint-disable */
var Client = function Client(host, port, path, clientId) {
var uri;
......@@ -226,7 +228,7 @@ var Client = function Client(host, port, path, clientId) {
this.connect = function (connectOptions) {
connectOptions = connectOptions || {};
validate(connectOptions, {
(0, _utils.validate)(connectOptions, {
timeout: 'number',
userName: 'string',
password: 'string',
......@@ -348,7 +350,7 @@ var Client = function Client(host, port, path, clientId) {
this.subscribe = function (filter, subscribeOptions) {
if (typeof filter !== 'string' && filter.constructor !== Array) throw new Error('Invalid argument:' + filter);
subscribeOptions = subscribeOptions || {};
validate(subscribeOptions, {
(0, _utils.validate)(subscribeOptions, {
qos: 'number',
invocationContext: 'object',
onSuccess: 'function',
......@@ -392,7 +394,7 @@ var Client = function Client(host, port, path, clientId) {
this.unsubscribe = function (filter, unsubscribeOptions) {
if (typeof filter !== 'string' && filter.constructor !== Array) throw new Error('Invalid argument:' + filter);
unsubscribeOptions = unsubscribeOptions || {};
validate(unsubscribeOptions, {
(0, _utils.validate)(unsubscribeOptions, {
invocationContext: 'object',
onSuccess: 'function',
onFailure: 'function',
......
......@@ -28,6 +28,11 @@ const Timeout = function (client, timeoutSeconds, action, args) {
clearTimeout(this.timeout);
};
};
const scope = function (f, scope) {
return function () {
return f.apply(scope, arguments);
};
};
/* eslint-disable */
const ClientImplementation = function (
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