diff --git a/packages/pubsub/src/vendor/paho-mqtt.js b/packages/pubsub/src/vendor/paho-mqtt.js index ffbc4e57bd1..36ff585af7d 100644 --- a/packages/pubsub/src/vendor/paho-mqtt.js +++ b/packages/pubsub/src/vendor/paho-mqtt.js @@ -102,23 +102,35 @@ function onMessageArrived(message) { /** * @private */ - var localStorage = - global.localStorage || - (function () { - var data = {}; - - return { - setItem: function (key, item) { - data[key] = item; - }, - getItem: function (key) { - return data[key]; - }, - removeItem: function (key) { - delete data[key]; - }, - }; - })(); + var localStorage; + try { + } catch (_unused) { + console.log('asd'); + } + + try { + localStorage = global.localStorage; + } catch (e) { + console.log(e); + } finally { + localStorage = + localStorage ?? + (function () { + var data = {}; + + return { + setItem: function (key, item) { + data[key] = item; + }, + getItem: function (key) { + return data[key]; + }, + removeItem: function (key) { + delete data[key]; + }, + }; + })(); + } /** * Unique message type identifiers, with associated