Skip to content

Commit 13ea27f

Browse files
committed
TextDecoder().decode
1 parent ac82187 commit 13ea27f

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

extension.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,11 @@ export default class HardDiskLEDExtension extends Extension {
2222
layoutManager = null;
2323
ioSpeedStaticIcon = null;
2424
ioSpeedIcon = null;
25-
byteArrayToString = null;
2625

2726
init() {
2827
this.cur = 0;
2928
this.lastCount = 0;
3029

31-
if (global.TextDecoder) {
32-
// available in gjs >= 1.70 (GNOME Shell >= 42)
33-
this.byteArrayToString = (new TextDecoder().decode);
34-
} else {
35-
// gjs-specific, imports.byteArray is still available in (GNOME Shell 45 >=) but discouraged!
36-
this.byteArrayToString = imports.byteArray.toString;
37-
}
3830
}
3931

4032
changeMode() {
@@ -51,7 +43,7 @@ export default class HardDiskLEDExtension extends Extension {
5143
let input_file = Gio.file_new_for_path('/proc/diskstats');
5244

5345
let [, contents, _etag] = input_file.load_contents(null);
54-
contents = this.byteArrayToString(contents);
46+
contents = new TextDecoder().decode(contents);
5547
let lines = contents.split('\n');
5648

5749
let count = 0;

metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
],
99
"url": "https://github.com/biji/harddiskled",
1010
"uuid": "harddiskled@bijidroid.gmail.com",
11-
"version": 36
11+
"version": 37
1212
}

0 commit comments

Comments
 (0)