@greymass/buoy
Advanced tools
Comparing version 1.0.3 to 1.0.4
/** | ||
* @greymass/buoy v1.0.3 | ||
* @greymass/buoy v1.0.4 | ||
* https://github.com/greymass/buoy-client | ||
@@ -4,0 +4,0 @@ * |
/** | ||
* @greymass/buoy v1.0.3 | ||
* @greymass/buoy v1.0.4 | ||
* https://github.com/greymass/buoy-client | ||
@@ -65,3 +65,3 @@ * | ||
const global$1 = globalThis || window; | ||
const globalBuoy$1 = globalThis || window; | ||
exports.ListenerEncoding = void 0; | ||
@@ -86,3 +86,3 @@ (function (ListenerEncoding) { | ||
this.encoding = options.encoding || exports.ListenerEncoding.text; | ||
this.WebSocket = options.WebSocket || global$1.WebSocket; | ||
this.WebSocket = options.WebSocket || globalBuoy$1.WebSocket; | ||
if (options.autoConnect !== false) { | ||
@@ -114,7 +114,7 @@ this.connect(); | ||
} | ||
else if (typeof global$1.Buffer !== 'undefined' && | ||
(event.data instanceof global$1.Buffer || Array.isArray(event.data))) { | ||
else if (typeof globalBuoy$1.Buffer !== 'undefined' && | ||
(event.data instanceof globalBuoy$1.Buffer || Array.isArray(event.data))) { | ||
let buffer = event.data; | ||
if (!global$1.Buffer.isBuffer(buffer)) { | ||
buffer = global$1.Buffer.concat(buffer); | ||
if (!globalBuoy$1.Buffer.isBuffer(buffer)) { | ||
buffer = globalBuoy$1.Buffer.concat(buffer); | ||
} | ||
@@ -267,3 +267,3 @@ this.handleMessage(new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength)); | ||
const global = globalThis || window; | ||
const globalBuoy = globalThis || window; | ||
/** Result of a [[send]] call. */ | ||
@@ -284,3 +284,3 @@ exports.SendResult = void 0; | ||
return tslib.__awaiter(this, void 0, void 0, function* () { | ||
const fetch = options.fetch || global.fetch; | ||
const fetch = options.fetch || globalBuoy.fetch; | ||
const baseUrl = options.service.replace(/^ws/, 'http').replace(/\/$/, ''); | ||
@@ -287,0 +287,0 @@ const url = `${baseUrl}/${options.channel}`; |
/** | ||
* @greymass/buoy v1.0.3 | ||
* @greymass/buoy v1.0.4 | ||
* https://github.com/greymass/buoy-client | ||
@@ -59,3 +59,3 @@ * | ||
const global$1 = globalThis || window; | ||
const globalBuoy$1 = globalThis || window; | ||
var ListenerEncoding; | ||
@@ -86,3 +86,3 @@ (function (ListenerEncoding) { | ||
this.encoding = options.encoding || ListenerEncoding.text; | ||
this.WebSocket = options.WebSocket || global$1.WebSocket; | ||
this.WebSocket = options.WebSocket || globalBuoy$1.WebSocket; | ||
if (options.autoConnect !== false) { | ||
@@ -114,7 +114,7 @@ this.connect(); | ||
} | ||
else if (typeof global$1.Buffer !== 'undefined' && | ||
(event.data instanceof global$1.Buffer || Array.isArray(event.data))) { | ||
else if (typeof globalBuoy$1.Buffer !== 'undefined' && | ||
(event.data instanceof globalBuoy$1.Buffer || Array.isArray(event.data))) { | ||
let buffer = event.data; | ||
if (!global$1.Buffer.isBuffer(buffer)) { | ||
buffer = global$1.Buffer.concat(buffer); | ||
if (!globalBuoy$1.Buffer.isBuffer(buffer)) { | ||
buffer = globalBuoy$1.Buffer.concat(buffer); | ||
} | ||
@@ -264,3 +264,3 @@ this.handleMessage(new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength)); | ||
const global = globalThis || window; | ||
const globalBuoy = globalThis || window; | ||
/** Result of a [[send]] call. */ | ||
@@ -280,3 +280,3 @@ var SendResult; | ||
async function send(message, options) { | ||
const fetch = options.fetch || global.fetch; | ||
const fetch = options.fetch || globalBuoy.fetch; | ||
const baseUrl = options.service.replace(/^ws/, 'http').replace(/\/$/, ''); | ||
@@ -283,0 +283,0 @@ const url = `${baseUrl}/${options.channel}`; |
{ | ||
"name": "@greymass/buoy", | ||
"description": "Client for buoy message forwarder", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"homepage": "https://github.com/greymass/buoy-client", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause", |
@@ -6,3 +6,3 @@ import EventEmitter from 'eventemitter3' | ||
const global = globalThis || window | ||
const globalBuoy = globalThis || window | ||
@@ -47,3 +47,3 @@ export enum ListenerEncoding { | ||
this.encoding = options.encoding || ListenerEncoding.text | ||
this.WebSocket = options.WebSocket || global.WebSocket | ||
this.WebSocket = options.WebSocket || globalBuoy.WebSocket | ||
if (options.autoConnect !== false) { | ||
@@ -75,8 +75,8 @@ this.connect() | ||
} else if ( | ||
typeof global.Buffer !== 'undefined' && | ||
(event.data instanceof global.Buffer || Array.isArray(event.data)) | ||
typeof globalBuoy.Buffer !== 'undefined' && | ||
(event.data instanceof globalBuoy.Buffer || Array.isArray(event.data)) | ||
) { | ||
let buffer = event.data | ||
if (!global.Buffer.isBuffer(buffer)) { | ||
buffer = global.Buffer.concat(buffer) | ||
if (!globalBuoy.Buffer.isBuffer(buffer)) { | ||
buffer = globalBuoy.Buffer.concat(buffer) | ||
} | ||
@@ -83,0 +83,0 @@ this.handleMessage( |
import type {Options} from './options' | ||
const global = globalThis || window | ||
const globalBuoy = globalThis || window | ||
@@ -39,3 +39,3 @@ /** Options for the [[send]] method. */ | ||
export async function send(message: SendData, options: SendOptions): Promise<SendResult> { | ||
const fetch = options.fetch || global.fetch | ||
const fetch = options.fetch || globalBuoy.fetch | ||
const baseUrl = options.service.replace(/^ws/, 'http').replace(/\/$/, '') | ||
@@ -42,0 +42,0 @@ const url = `${baseUrl}/${options.channel}` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
62670