@iobroker/adapter-react-v5 4.7.3 → 4.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,11 +16,11 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
16
16
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
17
17
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
18
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /**
19
- * Copyright 2020-2023, Denis Haev (bluefox) <dogafox@gmail.com>
20
- *
21
- * MIT License
22
- *
23
- **/
19
+ * Copyright 2020-2023, Denis Haev (bluefox) <dogafox@gmail.com>
20
+ *
21
+ * MIT License
22
+ *
23
+ **/
24
24
  /** Possible progress states. */
25
25
  var PROGRESS = exports.PROGRESS = {
26
26
  /** The socket is connecting. */
@@ -713,7 +713,7 @@ var Connection = /*#__PURE__*/function () {
713
713
  cbs: []
714
714
  };
715
715
  this.objectsSubscribes[_id].cbs.push(cb);
716
- ids.push(_id);
716
+ toSubscribe.push(_id);
717
717
  } else {
718
718
  !this.objectsSubscribes[_id].cbs.includes(cb) && this.objectsSubscribes[_id].cbs.push(cb);
719
719
  }
@@ -806,7 +806,7 @@ var Connection = /*#__PURE__*/function () {
806
806
  */
807
807
  }, {
808
808
  key: "subscribeFiles",
809
- value: function () {
809
+ value: (function () {
810
810
  var _subscribeFiles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(id, filePattern, cb) {
811
811
  var filePatterns, toSubscribe, f, pattern, key;
812
812
  return _regenerator["default"].wrap(function _callee$(_context) {
@@ -858,6 +858,7 @@ var Connection = /*#__PURE__*/function () {
858
858
  * @param {string} filePattern Pattern or file name, like 'main/*' or 'main/visViews.json`
859
859
  * @param {function} cb The callback.
860
860
  */
861
+ )
861
862
  }, {
862
863
  key: "unsubscribeFiles",
863
864
  value: function unsubscribeFiles(id, filePattern, cb) {
@@ -989,18 +990,23 @@ var Connection = /*#__PURE__*/function () {
989
990
 
990
991
  /**
991
992
  * Gets all states.
993
+ * @param {string} pattern The pattern to filter states.
992
994
  * @param {boolean} disableProgressUpdate don't call onProgress() when done
993
995
  * @returns {Promise<Record<string, ioBroker.State>>}
994
996
  */
995
997
  }, {
996
998
  key: "getStates",
997
- value: function getStates(disableProgressUpdate) {
999
+ value: function getStates(pattern, disableProgressUpdate) {
998
1000
  var _this7 = this;
999
1001
  if (!this.connected) {
1000
1002
  return Promise.reject(NOT_CONNECTED);
1001
1003
  }
1004
+ if (typeof pattern === 'boolean') {
1005
+ disableProgressUpdate = pattern;
1006
+ pattern = undefined;
1007
+ }
1002
1008
  return new Promise(function (resolve, reject) {
1003
- return _this7._socket.emit('getStates', function (err, res) {
1009
+ return _this7._socket.emit('getStates', pattern, function (err, res) {
1004
1010
  _this7.states = res;
1005
1011
  // @ts-ignore
1006
1012
  !disableProgressUpdate && _this7.onProgress(PROGRESS.STATES_LOADED);