@fleetbase/ember-core 0.2.21 → 0.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addon/services/theme.js +5 -1
- package/package.json +1 -1
package/addon/services/theme.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import Service from '@ember/service';
|
|
2
|
+
import Evented from '@ember/object/evented';
|
|
2
3
|
import { tracked } from '@glimmer/tracking';
|
|
3
4
|
import { inject as service } from '@ember/service';
|
|
4
5
|
import { computed } from '@ember/object';
|
|
5
6
|
import { dasherize } from '@ember/string';
|
|
6
7
|
import { isArray } from '@ember/array';
|
|
7
8
|
import { getOwner } from '@ember/application';
|
|
9
|
+
import { debug } from '@ember/debug';
|
|
8
10
|
|
|
9
|
-
export default class ThemeService extends Service {
|
|
11
|
+
export default class ThemeService extends Service.extend(Evented) {
|
|
10
12
|
/**
|
|
11
13
|
* Lookup the correct router for the engine and or console.
|
|
12
14
|
*
|
|
@@ -201,10 +203,12 @@ export default class ThemeService extends Service {
|
|
|
201
203
|
* @void
|
|
202
204
|
*/
|
|
203
205
|
setTheme(theme = 'light') {
|
|
206
|
+
debug(`Theme was changed to: ${theme}`);
|
|
204
207
|
document.body.classList.remove(`${this.currentTheme}-theme`);
|
|
205
208
|
document.body.classList.add(`${theme}-theme`);
|
|
206
209
|
this.currentUser.setOption('theme', theme);
|
|
207
210
|
this.activeTheme = theme;
|
|
211
|
+
this.trigger('theme.changed', theme);
|
|
208
212
|
}
|
|
209
213
|
|
|
210
214
|
/**
|
package/package.json
CHANGED