Skip to content

Commit

Permalink
fix: buffer is not defined in browser (#1420)
Browse files Browse the repository at this point in the history
  • Loading branch information
flyfishzy authored Feb 17, 2022
1 parent fad8ad6 commit f5ab1b5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions lib/connect/ali.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { Buffer } = require('buffer')
const Transform = require('readable-stream').Transform
const duplexify = require('duplexify')

Expand Down
1 change: 1 addition & 0 deletions lib/connect/ws.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { Buffer } = require('buffer')
const WS = require('ws')
const debug = require('debug')('mqttjs:ws')
const duplexify = require('duplexify')
Expand Down
1 change: 1 addition & 0 deletions lib/connect/wx.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const { Buffer } = require('buffer')
const Transform = require('readable-stream').Transform
const duplexify = require('duplexify')

Expand Down
16 changes: 5 additions & 11 deletions types/lib/connect/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
import { IClientOptions, MqttClient } from "../client";
/**
* connect - connect to an MQTT broker.
*
* @param {String} brokerUrl - url of the broker
*/
declare function connect(brokerUrl: string): MqttClient;
import { IClientOptions, MqttClient } from '../client'

/**
* connect - connect to an MQTT broker.
*
* @param {Object} opts - see MqttClient#constructor
*/
declare function connect(opts: IClientOptions): MqttClient;
declare function connect (opts: IClientOptions): MqttClient

/**
* connect - connect to an MQTT broker.
*
* @param {String} brokerUrl - url of the broker
* @param {Object} opts - see MqttClient#constructor
*/
declare function connect(brokerUrl: string, opts: IClientOptions): MqttClient;
declare function connect (brokerUrl: string, opts?: IClientOptions): MqttClient

export { connect };
export { MqttClient };
export { connect }
export { MqttClient }

0 comments on commit f5ab1b5

Please sign in to comment.