performance-marker.js (894B)
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 MESSAGES_ADD, 9 } = require("resource://devtools/client/webconsole/constants.js"); 10 11 const { 12 createPerformanceMarkerMiddleware, 13 } = require("resource://devtools/client/shared/redux/middleware/performance-marker.js"); 14 15 module.exports = function (sessionId) { 16 return createPerformanceMarkerMiddleware({ 17 [MESSAGES_ADD]: { 18 label: "WebconsoleAddMessages", 19 sessionId, 20 getMarkerDescription({ action, state }) { 21 const { messages } = action; 22 const totalMessageCount = state.messages.mutableMessagesById.size; 23 return `${messages.length} messages handled, store now has ${totalMessageCount} messages`; 24 }, 25 }, 26 }); 27 };