-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension.js
More file actions
55 lines (49 loc) · 1.37 KB
/
extension.js
File metadata and controls
55 lines (49 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
/**
* @param {string} name - The name parameter
* @returns {boolean} Whether it worked
*/
function helperFunction(name) {
return true;
}
export default class AiSlopExtension extends Extension {
enable() {
this._initializing = false;
this._pendingDestroy = false;
this._indicator = null;
if (Main.sessionMode.currentMode !== 'unlock-dialog' && this._indicator === null)
this._initAsync();
}
async _initAsync() {
if (this._initializing) return;
this._initializing = true;
try {
this._indicator = {};
if (this._pendingDestroy) return;
} finally {
this._initializing = false;
if (this._pendingDestroy) {
this._pendingDestroy = false;
this._cleanup();
}
}
}
_cleanup() {
if (this._initializing) {
this._pendingDestroy = true;
return;
}
if (this._indicator) {
try {
this._indicator.destroy();
} catch (e) {
console.error(`Error: ${e}`);
}
this._indicator = null;
}
}
disable() {
this._cleanup();
}
}