Skip to content

Commit

Permalink
refactor(types): add some initial configuration types apache#15486 (a…
Browse files Browse the repository at this point in the history
…pache#15487)

* refactor(types): add some initial configuration types apache#15486

* refactor: update
  • Loading branch information
John60676 authored Aug 5, 2021
1 parent 18ff3f5 commit 3a65992
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/core/echarts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,14 @@ type ECEventDefinition = {
// TODO: Use ECActionEvent
[key: string]: (...args: unknown[]) => void | boolean
};
type EChartsInitOpts = {
locale?: string | LocaleOption,
renderer?: RendererType,
devicePixelRatio?: number,
useDirtyRect?: boolean,
width?: number,
height?: number
};
class ECharts extends Eventful<ECEventDefinition> {

/**
Expand Down Expand Up @@ -387,14 +395,7 @@ class ECharts extends Eventful<ECEventDefinition> {
dom: HTMLElement,
// Theme name or themeOption.
theme?: string | ThemeOption,
opts?: {
locale?: string | LocaleOption,
renderer?: RendererType,
devicePixelRatio?: number,
useDirtyRect?: boolean,
width?: number,
height?: number
}
opts?: EChartsInitOpts
) {
super(new ECEventProcessor());

Expand Down Expand Up @@ -2537,17 +2538,13 @@ const DOM_ATTRIBUTE_KEY = '_echarts_instance_';
* Can be 'auto' (the same as null/undefined)
* @param opts.height Use clientHeight of the input `dom` by default.
* Can be 'auto' (the same as null/undefined)
* @param opts.locale Specify the locale.
* @param opts.useDirtyRect Enable dirty rectangle rendering or not.
*/
export function init(
dom: HTMLElement,
theme?: string | object,
opts?: {
renderer?: RendererType,
devicePixelRatio?: number,
width?: number,
height?: number,
locale?: string | LocaleOption
}
opts?: EChartsInitOpts
): EChartsType {
if (__DEV__) {
if (!dom) {
Expand Down

0 comments on commit 3a65992

Please sign in to comment.