You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2022/11/25 14:22:48 UTC
[echarts] 02/03: chore: use `hasGlobalWindow` constant from env util.
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch fix-null-check
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit b8f16efdce09030e2f36502b6e1e2a4d4cd33c88
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Fri Nov 25 22:06:34 2022 +0800
chore: use `hasGlobalWindow` constant from env util.
---
src/core/echarts.ts | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/core/echarts.ts b/src/core/echarts.ts
index 8a4283828..e84c1c89e 100644
--- a/src/core/echarts.ts
+++ b/src/core/echarts.ts
@@ -137,8 +137,6 @@ declare let global: any;
type ModelFinder = modelUtil.ModelFinder;
-const hasWindow = typeof window !== 'undefined';
-
export const version = '5.4.0';
export const dependencies = {
@@ -417,7 +415,7 @@ class ECharts extends Eventful<ECEventDefinition> {
if (__DEV__) {
const root = (
/* eslint-disable-next-line */
- hasWindow ? window : global
+ env.hasGlobalWindow ? window : global
) as any;
defaultRenderer = root.__ECHARTS__DEFAULT__RENDERER__ || defaultRenderer;
@@ -705,7 +703,7 @@ class ECharts extends Eventful<ECEventDefinition> {
getDevicePixelRatio(): number {
return (this._zr.painter as CanvasPainter).dpr
/* eslint-disable-next-line */
- || (hasWindow && window.devicePixelRatio) || 1;
+ || (env.hasGlobalWindow && window.devicePixelRatio) || 1;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org