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() {
|
||||
if (!connectionManager.getApiClient(serverId).isMessageChannelOpen()) {
|
||||
pollTasks();
|
||||
}
|
||||
}
|
||||
|
||||
var pollInterval;
|
||||
var button = options.button;
|
||||
var serverId = ApiClient.serverId();
|
||||
function startInterval() {
|
||||
var apiClient = connectionManager.getApiClient(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) {
|
||||
options.panel.classList.add("hide");
|
||||
|
@ -90,29 +108,11 @@ define(["events", "userSettings", "serverNotifications", "connectionManager", "e
|
|||
if (options.mode == 'off') {
|
||||
button.removeEventListener("click", onButtonClick);
|
||||
events.off(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate);
|
||||
|
||||
(function () {
|
||||
connectionManager.getApiClient(serverId).sendMessage("ScheduledTasksInfoStop");
|
||||
|
||||
if (pollInterval) {
|
||||
clearInterval(pollInterval);
|
||||
}
|
||||
})();
|
||||
stopInterval();
|
||||
} else {
|
||||
button.addEventListener("click", onButtonClick);
|
||||
pollTasks();
|
||||
|
||||
(function () {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
if (pollInterval) {
|
||||
clearInterval(pollInterval);
|
||||
}
|
||||
|
||||
apiClient.sendMessage("ScheduledTasksInfoStart", "1000,1000");
|
||||
pollInterval = setInterval(onPollIntervalFired, 1e4);
|
||||
})();
|
||||
|
||||
startInterval();
|
||||
events.on(serverNotifications, "ScheduledTasksInfo", onScheduledTasksUpdate);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue