(theme: Theme)
| 86 | } |
| 87 | |
| 88 | applyTheme(theme: Theme) { |
| 89 | if (typeof window === 'undefined' || typeof document === 'undefined') { |
| 90 | return; |
| 91 | } |
| 92 | if (theme.isDark === this.currentTheme.isDark) { |
| 93 | this.addColorTransition(); |
| 94 | this.renderTheme(theme); |
| 95 | // 通知外部主题变更 |
| 96 | this.notify(theme, 'themeChanged'); |
| 97 | setTimeout(() => {this.removeColorTransition(); }, THEME_CHANGE_TIME + THEME_CHANGE_DELAY); |
| 98 | } else { |
| 99 | this.themeHidden(); |
| 100 | setTimeout(() => { |
| 101 | this.removeColorTransition(); |
| 102 | this.renderTheme(theme); |
| 103 | |
| 104 | // 通知外部主题变更 |
| 105 | this.notify(theme, 'themeChanged'); |
| 106 | this.themeShow(); |
| 107 | setTimeout(() => {this.removeColorTransition(); }, THEME_CHANGE_TIME + THEME_CHANGE_DELAY); |
| 108 | }, THEME_CHANGE_TIME); |
| 109 | } |
| 110 | |
| 111 | } |
| 112 | |
| 113 | renderTheme(theme: Theme) { |
| 114 | this.currentTheme = theme; |
no test coverage detected