From f3dee504488c572277f6414e5f5be55089a23d0c Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 21 Jan 2014 21:29:54 +0100 Subject: [PATCH] Properly handle and trigger events --- couchpotato/core/_base/updater/static/updater.js | 2 +- couchpotato/core/notifications/core/static/notification.js | 2 +- couchpotato/static/scripts/couchpotato.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/couchpotato/core/_base/updater/static/updater.js b/couchpotato/core/_base/updater/static/updater.js index 860ad514..be436ed2 100644 --- a/couchpotato/core/_base/updater/static/updater.js +++ b/couchpotato/core/_base/updater/static/updater.js @@ -24,7 +24,7 @@ var UpdaterBase = new Class({ self.doUpdate(); else { App.unBlockPage(); - App.on('message', 'No updates available'); + App.trigger('message', ['No updates available']); } } }) diff --git a/couchpotato/core/notifications/core/static/notification.js b/couchpotato/core/notifications/core/static/notification.js index a0c3b15c..18d09e76 100644 --- a/couchpotato/core/notifications/core/static/notification.js +++ b/couchpotato/core/notifications/core/static/notification.js @@ -147,7 +147,7 @@ var NotificationBase = new Class({ // Process data if(json){ Array.each(json.result, function(result){ - App.trigger(result.type, result); + App.trigger(result.type, [result]); if(result.message && result.read === undefined) self.showMessage(result.message); }) diff --git a/couchpotato/static/scripts/couchpotato.js b/couchpotato/static/scripts/couchpotato.js index eae865f4..03332281 100644 --- a/couchpotato/static/scripts/couchpotato.js +++ b/couchpotato/static/scripts/couchpotato.js @@ -364,7 +364,7 @@ if(!on_complete && typeOf(args) == 'function'){ on_complete = args; - args = {}; + args = []; } // Create parallel callback @@ -372,7 +372,7 @@ self.global_events[name].each(function(handle, nr){ callbacks.push(function(callback){ - var results = handle(args || {}); + var results = handle.apply(handle, args || []); callback(null, results || null); }); @@ -593,4 +593,4 @@ var createSpinner = function(target, options){ }, options); return new Spinner(opts).spin(target); -}; \ No newline at end of file +};