binbot-charts 0.2.36 → 0.2.39

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.
@@ -39,7 +39,7 @@ function TVChartContainer(_ref) {
39
39
  const [widgetState, setWidgetState] = (0, _useImmer.useImmer)(null);
40
40
  const [symbolState] = (0, _react.useState)(null);
41
41
  const prevStates = (0, _hooks.usePrevious)({
42
- timescaleMarks
42
+ timescaleMarks: timescaleMarks
43
43
  });
44
44
  (0, _react.useEffect)(() => {
45
45
  if (!widgetState) {
@@ -54,9 +54,11 @@ function TVChartContainer(_ref) {
54
54
  widgetState.setSymbol(symbol, interval);
55
55
  }
56
56
 
57
- if (prevStates.timescaleMarks !== timescaleMarks) {
57
+ if (prevStates && prevStates.timescaleMarks !== timescaleMarks) {
58
58
  initializeChart();
59
59
  }
60
+
61
+ console.log(timescaleMarks);
60
62
  }, [orderLines, timescaleMarks]);
61
63
 
62
64
  const initializeChart = () => {
@@ -139,17 +139,8 @@ class Datafeed {
139
139
 
140
140
  getTimescaleMarks(symbolInfo, from, to, onDataCallback, resolution) {
141
141
  if (this.timescaleMarks.length > 0) {
142
- let timescaleMarks = [];
143
- this.timescaleMarks.forEach(mark => {
144
- let time = new Date(mark.time * 1000);
145
- time.setMinutes(0);
146
- time.setSeconds(0);
147
- time.setMilliseconds(0);
148
- const roundFloor = time.getTime() / 1000;
149
- mark.time = roundFloor;
150
- timescaleMarks.push(mark);
151
- });
152
- onDataCallback(timescaleMarks);
142
+ console.log(this.timescaleMarks);
143
+ onDataCallback(this.timescaleMarks);
153
144
  }
154
145
  }
155
146
 
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.usePrevious = usePrevious;
7
7
 
8
+ var _react = require("react");
9
+
8
10
  function usePrevious(value) {
9
- const ref = useRef();
10
- useEffect(() => {
11
+ const ref = (0, _react.useRef)();
12
+ (0, _react.useEffect)(() => {
11
13
  ref.current = value;
12
14
  });
13
15
  return ref.current;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.36",
2
+ "version": "0.2.39",
3
3
  "name": "binbot-charts",
4
4
  "dependencies": {
5
5
  "react": "^17.0.1",