polfan-server-js-client 0.1.994 → 0.1.995
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.
package/build/index.js
CHANGED
|
@@ -650,9 +650,10 @@ function TopicHistoryWindow_toPrimitive(input, hint) { if (TopicHistoryWindow_ty
|
|
|
650
650
|
|
|
651
651
|
var WindowState;
|
|
652
652
|
(function (WindowState) {
|
|
653
|
-
WindowState[WindowState["
|
|
654
|
-
WindowState[WindowState["
|
|
655
|
-
WindowState[WindowState["
|
|
653
|
+
WindowState[WindowState["EMPTY"] = 0] = "EMPTY";
|
|
654
|
+
WindowState[WindowState["LATEST_LIVE"] = 1] = "LATEST_LIVE";
|
|
655
|
+
WindowState[WindowState["LATEST_FETCHED"] = 2] = "LATEST_FETCHED";
|
|
656
|
+
WindowState[WindowState["PAST_FETCHED"] = 3] = "PAST_FETCHED";
|
|
656
657
|
})(WindowState || (WindowState = {}));
|
|
657
658
|
var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj) {
|
|
658
659
|
TopicHistoryWindow_inherits(TraversableRemoteCollection, _ObservableIndexedObj);
|
|
@@ -665,7 +666,7 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
665
666
|
}
|
|
666
667
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
667
668
|
TopicHistoryWindow_defineProperty(TopicHistoryWindow_assertThisInitialized(_this), "limit", 50);
|
|
668
|
-
TopicHistoryWindow_defineProperty(TopicHistoryWindow_assertThisInitialized(_this), "currentState", WindowState.
|
|
669
|
+
TopicHistoryWindow_defineProperty(TopicHistoryWindow_assertThisInitialized(_this), "currentState", WindowState.EMPTY);
|
|
669
670
|
TopicHistoryWindow_defineProperty(TopicHistoryWindow_assertThisInitialized(_this), "fetchingState", undefined);
|
|
670
671
|
return _this;
|
|
671
672
|
}
|
|
@@ -693,13 +694,13 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
693
694
|
switch (_context.prev = _context.next) {
|
|
694
695
|
case 0:
|
|
695
696
|
this.throwIfFetchingInProgress();
|
|
696
|
-
if (!(this.currentState === WindowState.
|
|
697
|
+
if (!(this.currentState === WindowState.LATEST_FETCHED)) {
|
|
697
698
|
_context.next = 3;
|
|
698
699
|
break;
|
|
699
700
|
}
|
|
700
701
|
return _context.abrupt("return");
|
|
701
702
|
case 3:
|
|
702
|
-
this.fetchingState = WindowState.
|
|
703
|
+
this.fetchingState = WindowState.LATEST_FETCHED;
|
|
703
704
|
_context.prev = 4;
|
|
704
705
|
_context.next = 7;
|
|
705
706
|
return this.fetchLatestItems();
|
|
@@ -712,7 +713,7 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
712
713
|
case 11:
|
|
713
714
|
this.deleteAll();
|
|
714
715
|
this.addItems(result, 'tail');
|
|
715
|
-
this.currentState = WindowState.
|
|
716
|
+
this.currentState = WindowState.LATEST_FETCHED;
|
|
716
717
|
case 14:
|
|
717
718
|
case "end":
|
|
718
719
|
return _context.stop();
|
|
@@ -735,7 +736,7 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
735
736
|
switch (_context2.prev = _context2.next) {
|
|
736
737
|
case 0:
|
|
737
738
|
this.throwIfFetchingInProgress();
|
|
738
|
-
this.fetchingState = WindowState.
|
|
739
|
+
this.fetchingState = WindowState.PAST_FETCHED;
|
|
739
740
|
_context2.prev = 2;
|
|
740
741
|
_context2.next = 5;
|
|
741
742
|
return this.fetchItemsBefore();
|
|
@@ -753,25 +754,13 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
753
754
|
return _context2.abrupt("return", this.resetToLatest());
|
|
754
755
|
case 11:
|
|
755
756
|
if (!result.length) {
|
|
756
|
-
_context2.next =
|
|
757
|
+
_context2.next = 15;
|
|
757
758
|
break;
|
|
758
759
|
}
|
|
759
760
|
this.addItems(result, 'head');
|
|
760
761
|
_context2.next = 15;
|
|
761
|
-
return this.
|
|
762
|
+
return this.refreshFetchedState();
|
|
762
763
|
case 15:
|
|
763
|
-
if (!_context2.sent) {
|
|
764
|
-
_context2.next = 19;
|
|
765
|
-
break;
|
|
766
|
-
}
|
|
767
|
-
_context2.t0 = WindowState.LATEST;
|
|
768
|
-
_context2.next = 20;
|
|
769
|
-
break;
|
|
770
|
-
case 19:
|
|
771
|
-
_context2.t0 = WindowState.PAST;
|
|
772
|
-
case 20:
|
|
773
|
-
this.currentState = _context2.t0;
|
|
774
|
-
case 21:
|
|
775
764
|
case "end":
|
|
776
765
|
return _context2.stop();
|
|
777
766
|
}
|
|
@@ -818,7 +807,7 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
818
807
|
}
|
|
819
808
|
this.addItems(result, 'tail');
|
|
820
809
|
_context3.next = 16;
|
|
821
|
-
return this.
|
|
810
|
+
return this.refreshFetchedState();
|
|
822
811
|
case 16:
|
|
823
812
|
case "end":
|
|
824
813
|
return _context3.stop();
|
|
@@ -832,9 +821,9 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
832
821
|
return fetchNext;
|
|
833
822
|
}()
|
|
834
823
|
}, {
|
|
835
|
-
key: "
|
|
824
|
+
key: "refreshFetchedState",
|
|
836
825
|
value: function () {
|
|
837
|
-
var
|
|
826
|
+
var _refreshFetchedState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
838
827
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
839
828
|
while (1) {
|
|
840
829
|
switch (_context4.prev = _context4.next) {
|
|
@@ -846,11 +835,11 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
846
835
|
_context4.next = 6;
|
|
847
836
|
break;
|
|
848
837
|
}
|
|
849
|
-
_context4.t0 = WindowState.
|
|
838
|
+
_context4.t0 = WindowState.LATEST_FETCHED;
|
|
850
839
|
_context4.next = 7;
|
|
851
840
|
break;
|
|
852
841
|
case 6:
|
|
853
|
-
_context4.t0 = WindowState.
|
|
842
|
+
_context4.t0 = WindowState.PAST_FETCHED;
|
|
854
843
|
case 7:
|
|
855
844
|
this.currentState = _context4.t0;
|
|
856
845
|
case 8:
|
|
@@ -860,11 +849,18 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
860
849
|
}
|
|
861
850
|
}, _callee4, this);
|
|
862
851
|
}));
|
|
863
|
-
function
|
|
864
|
-
return
|
|
852
|
+
function refreshFetchedState() {
|
|
853
|
+
return _refreshFetchedState.apply(this, arguments);
|
|
865
854
|
}
|
|
866
|
-
return
|
|
855
|
+
return refreshFetchedState;
|
|
867
856
|
}()
|
|
857
|
+
}, {
|
|
858
|
+
key: "refreshLiveState",
|
|
859
|
+
value: function refreshLiveState() {
|
|
860
|
+
if (this.currentState === WindowState.EMPTY && this.length) {
|
|
861
|
+
this.currentState = WindowState.LATEST_LIVE;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
868
864
|
}, {
|
|
869
865
|
key: "throwIfFetchingInProgress",
|
|
870
866
|
value: function throwIfFetchingInProgress() {
|
|
@@ -952,18 +948,11 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
952
948
|
while (1) {
|
|
953
949
|
switch (_context5.prev = _context5.next) {
|
|
954
950
|
case 0:
|
|
955
|
-
if (
|
|
956
|
-
|
|
957
|
-
|
|
951
|
+
if ([WindowState.LATEST_FETCHED, WindowState.LATEST_LIVE, WindowState.EMPTY].includes(this.state) && ev.location.roomId === this.roomId && ev.location.topicId === this.topicId) {
|
|
952
|
+
this.set(ev.message);
|
|
953
|
+
this.refreshLiveState();
|
|
958
954
|
}
|
|
959
|
-
|
|
960
|
-
if (!(this.state === WindowState.UNINITIALIZED)) {
|
|
961
|
-
_context5.next = 5;
|
|
962
|
-
break;
|
|
963
|
-
}
|
|
964
|
-
_context5.next = 5;
|
|
965
|
-
return this.refreshMode();
|
|
966
|
-
case 5:
|
|
955
|
+
case 1:
|
|
967
956
|
case "end":
|
|
968
957
|
return _context5.stop();
|
|
969
958
|
}
|
|
@@ -1189,7 +1178,7 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1189
1178
|
return this.getLatestMessageId();
|
|
1190
1179
|
case 2:
|
|
1191
1180
|
lastMessageId = _context11.sent;
|
|
1192
|
-
return _context11.abrupt("return", lastMessageId ? this.has(lastMessageId) :
|
|
1181
|
+
return _context11.abrupt("return", lastMessageId ? this.has(lastMessageId) : true);
|
|
1193
1182
|
case 4:
|
|
1194
1183
|
case "end":
|
|
1195
1184
|
return _context11.stop();
|