Skip to content

Commit

Permalink
[react-javascript] Removed TradingView.onready's usage
Browse files Browse the repository at this point in the history
  • Loading branch information
timocov committed Aug 7, 2018
1 parent b904b17 commit e692c7c
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions react-javascript/src/components/TVChartContainer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,21 @@ export class TVChartContainer extends React.PureComponent {
studies_overrides: this.props.studiesOverrides,
};

window.TradingView.onready(() => {
const widget = window.tvWidget = new window.TradingView.widget(widgetOptions);
const widget = new window.TradingView.widget(widgetOptions);

widget.onChartReady(() => {
const button = widget.createButton()
.attr('title', 'Click to show a notification popup')
.addClass('apply-common-tooltip')
.on('click', () => widget.showNoticeDialog({
title: 'Notification',
body: 'TradingView Charting Library API works correctly',
callback: () => {
console.log('Noticed!');
},
}));
widget.onChartReady(() => {
const button = widget.createButton()
.attr('title', 'Click to show a notification popup')
.addClass('apply-common-tooltip')
.on('click', () => widget.showNoticeDialog({
title: 'Notification',
body: 'TradingView Charting Library API works correctly',
callback: () => {
console.log('Noticed!');
},
}));

button[0].innerHTML = 'Check API';
});
button[0].innerHTML = 'Check API';
});
}

Expand Down

0 comments on commit e692c7c

Please sign in to comment.