Skip to content

Commit

Permalink
ULMS-3266 Added safari 15 check for mqtt client
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkonst committed Aug 15, 2024
1 parent 66b72da commit 9c33b96
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ulms/api-clients",
"version": "7.12.1",
"version": "7.12.1-dev.1-ULMS-3266",
"description": "JavaScript API clients for ULMS platform",
"keywords": [],
"homepage": "https://github.com/foxford/ulms-api-clients-js#readme",
Expand Down
10 changes: 8 additions & 2 deletions src/mqtt.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable max-classes-per-file */
/* global mqtt */
/* global bowser, mqtt */

// using version from cdn
// import mqtt from 'mqtt'
Expand Down Expand Up @@ -39,7 +39,13 @@ class MQTTClient {

static async loadDependencies() {
const isBigIntSupported = typeof BigInt !== 'undefined'
const mqttVersion = isBigIntSupported ? '5.9.1' : '3.0.0'
const isOldBrowserVersion = bowser
.getParser(window.navigator.userAgent)
.satisfies({
safari: '<15',
})
const mqttVersion =
isBigIntSupported && !isOldBrowserVersion ? '5.9.1' : '3.0.0'
const source = `https://ulms-static.foxford.ngcdn.ru/prod/js/mqtt@${mqttVersion}/dist/mqtt.min.js`

return retry(() => loadScript(source))
Expand Down

0 comments on commit 9c33b96

Please sign in to comment.