@orbis-systems/orbis-chart-react
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -0,3 +1,4 @@ | ||
export * from './OrbisChart'; | ||
export { default } from './OrbisChart'; | ||
export * from './OrbisChart'; | ||
import TradingView from './charting-library'; | ||
interface OrbisDatafeedConstructor { | ||
@@ -4,0 +5,0 @@ new (apiUrl: string, updateInterval: number, type: 'delayed' | 'stock'): TradingView.ChartingLibraryWidgetOptions['datafeed']; |
@@ -1,1 +0,1 @@ | ||
import t from"react";class e extends t.Component{constructor(){super(...arguments),this.containerId="orbis-chart-container-"+Math.random(),this.componentDidMount=()=>{this.appendScript(this.initWidget)},this.componentDidUpdate=()=>{this.cleanupWidget(),this.initWidget()},this.canUseDOM=()=>!("undefined"==typeof window||!window.document||!window.document.createElement),this.appendScript=t=>{var e;if(!this.canUseDOM())return void t();let i=document.getElementById("orbis-chart-script");if(null===i)i=document.createElement("script"),i.id="orbis-chart-script",i.type="text/javascript",i.async=!0,i.src=null!==(e=this.props.apiUrl)&&void 0!==e?e:"https://charts.orbis.dev/js/chart.js",i.onload=t,document.getElementsByTagName("head")[0].appendChild(i);else{if("undefined"==typeof TradingView){const e=i.onload;return void(i.onload=i=>{null==e||e.call(document,i),t()})}t()}},this.initWidget=()=>{if("undefined"==typeof TradingView||!document.getElementById(this.containerId))return;const{libPath:t="https://charts.orbis.dev/api/",quoteType:e="delayed",updateInterval:i=2e3,chartConfig:n}=this.props;new TradingView.widget(Object.assign(Object.assign({locale:"en",interval:"D"},n),{container_id:this.containerId,datafeed:new OrbisDatafeed(t,i,e)}))},this.cleanupWidget=()=>{if(!this.canUseDOM())return;const t=document.getElementById(this.containerId);t&&(t.innerHTML="")},this.getStyle=()=>{var t;return(null===(t=this.props.chartConfig)||void 0===t?void 0:t.autosize)?{width:"100%",height:"100%"}:{}},this.render=()=>t.createElement("div",{id:this.containerId,style:this.getStyle()})}}export default e; | ||
import t from"react";class e extends t.Component{constructor(){super(...arguments),this.containerId="orbis-chart-container-"+Math.random(),this.componentDidMount=()=>{this.appendScript(this.initWidget)},this.componentDidUpdate=()=>{this.cleanupWidget(),this.initWidget()},this.canUseDOM=()=>!("undefined"==typeof window||!window.document||!window.document.createElement),this.appendScript=t=>{var e;if(!this.canUseDOM())return void t();let i=document.getElementById("orbis-chart-script");if(null===i)i=document.createElement("script"),i.id="orbis-chart-script",i.type="text/javascript",i.async=!0,i.src=null!==(e=this.props.apiUrl)&&void 0!==e?e:"https://charts.orbis.dev/js/chart.js",i.onload=t,document.getElementsByTagName("head")[0].appendChild(i);else{if("undefined"==typeof TradingView){const e=i.onload;return void(i.onload=i=>{null==e||e.call(document,i),t()})}t()}},this.initWidget=()=>{if("undefined"==typeof TradingView||!document.getElementById(this.containerId))return;const{libPath:t="https://charts.orbis.dev/api/",quoteType:e="delayed",updateInterval:i=2e3,chartConfig:n}=this.props;new TradingView.widget(Object.assign(Object.assign({locale:"en",interval:"D",autosize:!0},n),{container_id:this.containerId,datafeed:new OrbisDatafeed(t,i,e)}))},this.cleanupWidget=()=>{if(!this.canUseDOM())return;const t=document.getElementById(this.containerId);t&&(t.innerHTML="")},this.getStyle=()=>{var t;return(null===(t=this.props.chartConfig)||void 0===t?void 0:t.autosize)?{width:"100%",height:"100%"}:{}},this.render=()=>t.createElement("div",{id:this.containerId,style:this.getStyle()})}}export default e; |
import React from 'react'; | ||
import { TradingTerminalWidgetOptions } from './charting-library'; | ||
declare type Props = { | ||
@@ -7,3 +8,3 @@ apiUrl?: string; | ||
updateInterval?: number; | ||
chartConfig: Partial<TradingView.TradingTerminalWidgetOptions>; | ||
chartConfig: Partial<TradingTerminalWidgetOptions>; | ||
}; | ||
@@ -10,0 +11,0 @@ declare class OrbisChart extends React.Component<Props> { |
{ | ||
"name": "@orbis-systems/orbis-chart-react", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
59632
1571