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/. */
11 } = require("resource://devtools/client/application/src/constants.js");
13 function eventTelemetryMiddleware(telemetry
) {
14 function recordEvent(method
, details
= {}) {
15 telemetry
.recordEvent(method
, "application", null, details
);
18 return () => next
=> action
=> {
19 switch (action
.type
) {
21 case UPDATE_SELECTED_PAGE
:
22 recordEvent("select_page", { page_type
: action
.selectedPage
});
24 // service-worker related telemetry
25 case UNREGISTER_WORKER
:
26 recordEvent("unregister_worker");
29 recordEvent("start_worker");
37 module
.exports
= eventTelemetryMiddleware
;