@micropermit/client-angular 0.2.8 → 0.2.9-beta.1

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.
@@ -766,6 +766,7 @@
766
766
  var _this = _super.call(this, link, microClient, callParams, requestOptions) || this;
767
767
  _this.initialized = false;
768
768
  _this.serializeTo = LinkSerializer.AS_VALUE_IF_INITIALIZED;
769
+ _this.intervalId = null;
769
770
  if (initialized) {
770
771
  _this.set(initialValue);
771
772
  }
@@ -812,17 +813,69 @@
812
813
  return this._getPromise;
813
814
  };
814
815
  /**
816
+ * @param {?=} interval
815
817
  * @return {?}
816
818
  */
817
- LinkField.prototype.getObs = /**
819
+ LinkField.prototype.refresh = /**
820
+ * @param {?=} interval
821
+ * @return {?}
822
+ */
823
+ function (interval) {
824
+ var _this = this;
825
+ if (interval) {
826
+ this.stopRefresh();
827
+ }
828
+ this.initWithObs();
829
+ if (interval) {
830
+ this.intervalId = setInterval((/**
831
+ * @return {?}
832
+ */
833
+ function () {
834
+ _this.initWithObs().subscribe();
835
+ }), interval);
836
+ }
837
+ };
838
+ /**
839
+ * @return {?}
840
+ */
841
+ LinkField.prototype.stopRefresh = /**
818
842
  * @return {?}
819
843
  */
820
844
  function () {
821
- if (!this._getObs) {
822
- this._getObs = this.initWithObs(null, null).pipe(operators.shareReplay(1));
823
- this._getPromise = null;
845
+ if (this.intervalId) {
846
+ clearInterval(this.intervalId);
824
847
  }
825
- return this._getObs;
848
+ };
849
+ /**
850
+ * @return {?}
851
+ */
852
+ LinkField.prototype.listenObs = /**
853
+ * @return {?}
854
+ */
855
+ function () {
856
+ var _this = this;
857
+ if (this.valueSubj) {
858
+ return this.valueSubj;
859
+ }
860
+ else {
861
+ this.valueSubj = new rxjs.ReplaySubject(1);
862
+ return rxjs.defer((/**
863
+ * @return {?}
864
+ */
865
+ function () {
866
+ _this.initWithObs(null, null).subscribe();
867
+ return _this.valueSubj;
868
+ }));
869
+ }
870
+ };
871
+ /**
872
+ * @return {?}
873
+ */
874
+ LinkField.prototype.getObs = /**
875
+ * @return {?}
876
+ */
877
+ function () {
878
+ return this.listenObs().pipe(operators.take(1));
826
879
  };
827
880
  /**
828
881
  * @param {?} value
@@ -837,7 +890,10 @@
837
890
  var oldValue = this.value;
838
891
  this.value = value;
839
892
  this.initialized = true;
840
- this._getObs = rxjs.of(this.value).pipe(operators.shareReplay(1));
893
+ if (!this.valueSubj) {
894
+ this.valueSubj = new rxjs.ReplaySubject(1);
895
+ }
896
+ this.valueSubj.next(value);
841
897
  this._getPromise = null;
842
898
  return oldValue;
843
899
  };
@@ -859,7 +915,7 @@
859
915
  function () {
860
916
  this.value = null;
861
917
  this.initialized = false;
862
- this._getObs = null;
918
+ this.valueSubj = null;
863
919
  this._getPromise = null;
864
920
  };
865
921
  /**
@@ -975,14 +1031,19 @@
975
1031
  * @type {?}
976
1032
  * @private
977
1033
  */
978
- LinkField.prototype._getObs;
1034
+ LinkField.prototype._getPromise;
979
1035
  /**
980
1036
  * @type {?}
981
1037
  * @private
982
1038
  */
983
- LinkField.prototype._getPromise;
1039
+ LinkField.prototype.valueSubj;
984
1040
  /** @type {?} */
985
1041
  LinkField.prototype.serializeTo;
1042
+ /**
1043
+ * @type {?}
1044
+ * @private
1045
+ */
1046
+ LinkField.prototype.intervalId;
986
1047
  }
987
1048
 
988
1049
  /**
@@ -1588,7 +1649,7 @@
1588
1649
  * @return {?}
1589
1650
  */
1590
1651
  function (val) {
1591
- return (/** @type {?} */ (MicroObject.fromObject(val, _this)));
1652
+ return MicroObject.fromObject(val, _this);
1592
1653
  })), this.catchAndHandleError());
1593
1654
  return httpObs;
1594
1655
  };