(priority: number, interval: number, func: () => boolean)
| 6 | static timeoutIdList = [] as number[]; |
| 7 | |
| 8 | static addTimeout(priority: number, interval: number, func: () => boolean) { |
| 9 | const timeoutId = GLib.timeout_add(priority, interval, () => { |
| 10 | const source = func(); |
| 11 | if (source == GLib.SOURCE_REMOVE) { |
| 12 | this.clearTimeoutId(timeoutId); |
| 13 | } |
| 14 | return source; |
| 15 | }); |
| 16 | this.timeoutIdList.push(timeoutId); |
| 17 | return timeoutId; |
| 18 | } |
| 19 | |
| 20 | static clearTimeoutId(timeoutId: number) { |
| 21 | if (timeoutId && this.timeoutIdList.includes(timeoutId)) { |
no test coverage detected