notifications.js (890B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 const { 8 APPEND_NOTIFICATION, 9 REMOVE_NOTIFICATION, 10 } = require("resource://devtools/client/webconsole/constants.js"); 11 12 /** 13 * Append a notification into JSTerm notification list. 14 */ 15 function appendNotification( 16 label, 17 value, 18 image, 19 priority, 20 buttons = [], 21 eventCallback 22 ) { 23 return { 24 type: APPEND_NOTIFICATION, 25 label, 26 value, 27 image, 28 priority, 29 buttons, 30 eventCallback, 31 }; 32 } 33 34 /** 35 * Remove notification with specified value from JSTerm 36 * notification list. 37 */ 38 function removeNotification(value) { 39 return { 40 type: REMOVE_NOTIFICATION, 41 value, 42 }; 43 } 44 45 module.exports = { 46 appendNotification, 47 removeNotification, 48 };