1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/addon-sdk/source/lib/sdk/input/customizable-ui.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,28 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 +"use strict"; 1.8 + 1.9 +const { Cu } = require("chrome"); 1.10 +const { CustomizableUI } = Cu.import('resource:///modules/CustomizableUI.jsm', {}); 1.11 +const { receive } = require("../event/utils"); 1.12 +const { InputPort } = require("./system"); 1.13 +const { object} = require("../util/sequence"); 1.14 +const { getOuterId } = require("../window/utils"); 1.15 + 1.16 +const Input = function() {}; 1.17 +Input.prototype = Object.create(InputPort.prototype); 1.18 + 1.19 +Input.prototype.onCustomizeStart = function (window) { 1.20 + receive(this, object([getOuterId(window), true])); 1.21 +} 1.22 + 1.23 +Input.prototype.onCustomizeEnd = function (window) { 1.24 + receive(this, object([getOuterId(window), null])); 1.25 +} 1.26 + 1.27 +Input.prototype.addListener = input => CustomizableUI.addListener(input); 1.28 + 1.29 +Input.prototype.removeListener = input => CustomizableUI.removeListener(input); 1.30 + 1.31 +exports.CustomizationInput = Input;