From 81805ce3f63e2e4a799bd54f174083c58a9b5640 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 16 Oct 2016 19:34:53 -0400 Subject: Move Mozilla DevTools to Platform - Part 3: Merge the browser/devtools and toolkit/devtools adjusting for directory collisions --- .../devtools/projecteditor/lib/helpers/prompts.js | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 toolkit/devtools/projecteditor/lib/helpers/prompts.js (limited to 'toolkit/devtools/projecteditor/lib/helpers/prompts.js') diff --git a/toolkit/devtools/projecteditor/lib/helpers/prompts.js b/toolkit/devtools/projecteditor/lib/helpers/prompts.js new file mode 100644 index 000000000..b10efb4bf --- /dev/null +++ b/toolkit/devtools/projecteditor/lib/helpers/prompts.js @@ -0,0 +1,33 @@ +/* -*- Mode: Javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * This file contains helper functions for showing user prompts. + * See https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIPromptService + */ + +const { Cu, Cc, Ci } = require("chrome"); +const { getLocalizedString } = require("projecteditor/helpers/l10n"); +const prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Ci.nsIPromptService); + +/** + * Show a prompt. + * + * @param string title + * The title to the dialog + * @param string message + * The message to display + * + * @return bool + * Whether the user has confirmed the action + */ +function confirm(title, message) { + var result = prompts.confirm(null, title || "Title of this Dialog", message || "Are you sure?"); + return result; +} +exports.confirm = confirm; + -- cgit v1.2.3