Skip to content

Commit

Permalink
creating object in global scope is not allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
biji committed Apr 8, 2022
1 parent 14373b6 commit 1889c6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ let lastCount = 0, lastSpeed = 0, lastCountUp = 0;
let mode; // 0: kbps 1: K/s 2: U:kbps D:kbps 3: U:K/s D:K/s 4: Total KB
let fontmode;
let resetNextCount = false, resetCount = 0;
let byteArrayToString;

if (global.TextDecoder) {
// available in gjs >= 1.70 (GNOME Shell >= 42)
byteArrayToString = (new TextDecoder().decode);
}
else {
// gjs-specific
byteArrayToString = imports.byteArray.toString;
function byteArrayToString(bytes) {
if (global.TextDecoder) {
return new TextDecoder().decode(bytes);
}

return imports.byteArray.toString(bytes);
}

function init() {
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
],
"url": "https://github.com/biji/simplenetspeed",
"uuid": "[email protected]",
"version": 26
"version": 28
}

0 comments on commit 1889c6a

Please sign in to comment.