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: 'use strict'; michael@0: michael@0: module.metadata = { michael@0: "stability": "experimental" michael@0: }; michael@0: michael@0: const { emit, off } = require("./event/core"); michael@0: const { PrefsTarget } = require("./preferences/event-target"); michael@0: const { preferencesBranch, id } = require("./self"); michael@0: const { on } = require("./system/events"); michael@0: michael@0: const ADDON_BRANCH = "extensions." + preferencesBranch + "."; michael@0: const BUTTON_PRESSED = id + "-cmdPressed"; michael@0: michael@0: const target = PrefsTarget({ branchName: ADDON_BRANCH }); michael@0: michael@0: // Listen to clicks on buttons michael@0: function buttonClick({ data }) { michael@0: emit(target, data); michael@0: } michael@0: on(BUTTON_PRESSED, buttonClick); michael@0: michael@0: module.exports = target;