michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: // This module basically translates system/events to a SDK standard events michael@0: // so that `map`, `filter` and other utilities could be used with them. michael@0: michael@0: module.metadata = { michael@0: "stability": "experimental" michael@0: }; michael@0: michael@0: const events = require("../system/events"); michael@0: const { emit } = require("../event/core"); michael@0: michael@0: let channel = {}; michael@0: michael@0: function forward({ subject, type, data }) michael@0: emit(channel, "data", { target: subject, type: type, data: data }); michael@0: michael@0: ["popupshowing", "popuphiding", "popupshown", "popuphidden", michael@0: "document-element-inserted", "DOMContentLoaded", "load" michael@0: ].forEach(function(type) events.on(type, forward)); michael@0: michael@0: exports.events = channel;