mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update taskbutton Suggested change
This commit is contained in:
parent
e7570d856f
commit
0e306cad76
1 changed files with 23 additions and 23 deletions
|
@ -73,15 +73,33 @@ define(["events", "userSettings", "serverNotifications", "connectionManager", "e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pollInterval;
|
||||||
|
var button = options.button;
|
||||||
|
var serverId = ApiClient.serverId();
|
||||||
|
|
||||||
function onPollIntervalFired() {
|
function onPollIntervalFired() {
|
||||||
if (!connectionManager.getApiClient(serverId).isMessageChannelOpen()) {
|
if (!connectionManager.getApiClient(serverId).isMessageChannelOpen()) {
|
||||||
pollTasks();
|
pollTasks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var pollInterval;
|
function startInterval() {
|
||||||
var button = options.button;
|
var apiClient = connectionManager.getApiClient(serverId);
|
||||||
var serverId = ApiClient.serverId();
|
|
||||||
|
if (pollInterval) {
|
||||||
|
clearInterval(pollInterval);
|
||||||
|
}
|
||||||
|
apiClient.sendMessage("ScheduledTasksInfoStart", "1000,1000");
|
||||||
|
pollInterval = setInterval(onPollIntervalFired, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopInterval() {
|
||||||
|
connectionManager.getApiClient(serverId).sendMessage("ScheduledTasksInfoStop");
|
||||||
|
|
||||||
|
if (pollInterval) {
|
||||||
|
clearInterval(pollInterval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (options.panel) {
|
if (options.panel) {
|
||||||
options.panel.classList.add("hide");
|
options.panel.classList.add("hide");
|
||||||
|
@ -90,29 +108,11 @@ define(["events", "userSettings", "serverNotifications", "connectionManager", "e
|
||||||
if (options.mode == 'off') {
|
if (options.mode == 'off') {
|
||||||
button.removeEventListener("click", onButtonClick);
|
button.removeEventListener("click", onButtonClick);
|
||||||
events.off(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate);
|
events.off(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate);
|
||||||
|
stopInterval();
|
||||||
(function () {
|
|
||||||
connectionManager.getApiClient(serverId).sendMessage("ScheduledTasksInfoStop");
|
|
||||||
|
|
||||||
if (pollInterval) {
|
|
||||||
clearInterval(pollInterval);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
} else {
|
} else {
|
||||||
button.addEventListener("click", onButtonClick);
|
button.addEventListener("click", onButtonClick);
|
||||||
pollTasks();
|
pollTasks();
|
||||||
|
startInterval();
|
||||||
(function () {
|
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
|
||||||
|
|
||||||
if (pollInterval) {
|
|
||||||
clearInterval(pollInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
apiClient.sendMessage("ScheduledTasksInfoStart", "1000,1000");
|
|
||||||
pollInterval = setInterval(onPollIntervalFired, 1e4);
|
|
||||||
})();
|
|
||||||
|
|
||||||
events.on(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate);
|
events.on(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue