From 84d20bf62bc12ca75730f9a55a008a63f3e18eaf Mon Sep 17 00:00:00 2001 From: Walle Cyril Date: Sun, 14 Oct 2018 02:23:42 +0200 Subject: [PATCH] do not expose private --- src/sandbox/sandbox.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/sandbox/sandbox.js b/src/sandbox/sandbox.js index 5542f7c..4b4a90c 100644 --- a/src/sandbox/sandbox.js +++ b/src/sandbox/sandbox.js @@ -11,8 +11,12 @@ var Sandbox = function(module) { this.module = module; }; -// All notifications from sandbox -Sandbox.notifications = {}; +/** +* All notifications from sandbox +* +* @private +*/ +var notifications = {}; /** * Clear all notifications from an specific module @@ -21,7 +25,7 @@ Sandbox.notifications = {}; * @param {string} module the name of the module */ Sandbox.clearNotifications = function(module) { - delete Sandbox.notifications[module]; + delete notifications[module]; }; /** @@ -31,8 +35,8 @@ Sandbox.clearNotifications = function(module) { * @param {object} notification the object with notifications configs */ Sandbox.prototype.notify = function(notification) { - for(var module in Sandbox.notifications) { - var listening = Sandbox.notifications[module][notification.type]; + for(var module in notifications) { + var listening = notifications[module][notification.type]; if(listening) { listening.callback.call(listening.context, notification.data); } @@ -65,8 +69,7 @@ Sandbox.prototype.listen = function(notification) { * @param {boolean} replace if the notification already exists, it forces to rewrite it */ Sandbox.prototype.addNotification = function(notification, callback, context, replace) { - var notifications = Sandbox.notifications, - addNotification = false; + var addNotification = false; if(!notifications[this.module] || !notifications[this.module][notification]) { addNotification = true;