Use ES6 class for extension object
This commit is contained in:
parent
d343f6132c
commit
5d6f63d6cf
1 changed files with 6 additions and 8 deletions
|
|
@ -1,11 +1,9 @@
|
||||||
const ExtensionUtils = imports.misc.extensionUtils;
|
const ExtensionUtils = imports.misc.extensionUtils;
|
||||||
const BaTime = ExtensionUtils.getCurrentExtension();
|
const BaTime = ExtensionUtils.getCurrentExtension();
|
||||||
const Lang = imports.lang;
|
|
||||||
const Panel = imports.ui.main.panel;
|
const Panel = imports.ui.main.panel;
|
||||||
|
|
||||||
var BaTimeExtension = new Lang.Class({
|
class BaTimeExtension {
|
||||||
Name: 'BaTime',
|
constructor() {
|
||||||
_init: function () {
|
|
||||||
this.aggregateMenu = Panel.statusArea['aggregateMenu'];
|
this.aggregateMenu = Panel.statusArea['aggregateMenu'];
|
||||||
this.originalIndicator = this.aggregateMenu._power;
|
this.originalIndicator = this.aggregateMenu._power;
|
||||||
this.customIndicator = new BaTime.imports.power.Indicator();
|
this.customIndicator = new BaTime.imports.power.Indicator();
|
||||||
|
|
@ -13,14 +11,14 @@ var BaTimeExtension = new Lang.Class({
|
||||||
this.originalIndicator.indicators,
|
this.originalIndicator.indicators,
|
||||||
this.customIndicator.indicators
|
this.customIndicator.indicators
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
destroy: function () {
|
destroy() {
|
||||||
this.aggregateMenu._indicators.replace_child(
|
this.aggregateMenu._indicators.replace_child(
|
||||||
this.customIndicator.indicators,
|
this.customIndicator.indicators,
|
||||||
this.originalIndicator.indicators
|
this.originalIndicator.indicators
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
let baTime;
|
let baTime;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue