AutoOrganize: Differentiate server events

This commit is contained in:
softworkz 2016-08-23 05:35:59 +02:00
parent 30a8d63a16
commit ed2f72f2a5

View File

@ -325,7 +325,12 @@
function onServerEvent(e, apiClient, data) {
if (data) {
if (e.type == 'ScheduledTaskEnded') {
if (data && data.Key == 'AutoOrganize') {
reloadItems(page, false);
}
} else if (e.type == 'AutoOrganize_ItemUpdated' && data) {
updateItemStatus(page, data);
} else {
@ -380,7 +385,11 @@
reloadItems(view, true);
events.on(serverNotifications, 'AutoOrganizeUpdate', onServerEvent);
events.on(serverNotifications, 'AutoOrganize_LogReset', onServerEvent);
events.on(serverNotifications, 'AutoOrganize_ItemUpdated', onServerEvent);
events.on(serverNotifications, 'AutoOrganize_ItemRemoved', onServerEvent);
events.on(serverNotifications, 'AutoOrganize_ItemAdded', onServerEvent);
events.on(serverNotifications, 'ScheduledTaskEnded', onServerEvent);
// on here
taskButton({
@ -396,7 +405,11 @@
currentResult = null;
events.off(serverNotifications, 'AutoOrganizeUpdate', onServerEvent);
events.off(serverNotifications, 'AutoOrganize_LogReset', onServerEvent);
events.off(serverNotifications, 'AutoOrganize_ItemUpdated', onServerEvent);
events.off(serverNotifications, 'AutoOrganize_ItemRemoved', onServerEvent);
events.off(serverNotifications, 'AutoOrganize_ItemAdded', onServerEvent);
events.off(serverNotifications, 'ScheduledTaskEnded', onServerEvent);
// off here
taskButton({