Skip to content

Commit

Permalink
fix: Add JSDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelkaron committed Feb 25, 2019
1 parent dc2f28b commit 4ba3e28
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ import '@stencil/core';
export namespace Components {

interface ApexChart {
/**
* ApexCharts options
*/
'options': object;
}
interface ApexChartAttributes extends StencilHTMLAttributes {
/**
* ApexCharts options
*/
'options'?: object;
}
}
Expand Down
13 changes: 10 additions & 3 deletions src/components/apex-chart/apex-chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ import ApexCharts from 'apexcharts';
shadow: false
})
export class chart {
el: HTMLElement;
chartRef: HTMLElement;

/**
* Internal ApexCharts instance
*/
@State() chart: ApexCharts = null;

/**
* ApexCharts options
*/
@Prop() options: object = {}

componentDidLoad() {
if (this.chart === null) {
this.chart = new ApexCharts(this.el, this.options);
this.chart = new ApexCharts(this.chartRef, this.options);
return this.chart.render();
}
}
Expand All @@ -25,6 +32,6 @@ export class chart {
}
}
render() {
return <div ref={(el) => this.el = el}></div>;
return <div ref={(el) => this.chartRef = el}></div>;
}
}

0 comments on commit 4ba3e28

Please sign in to comment.