proper function wrapping in Notification.js