From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- .../add-ons/webextensions/user_actions/index.html | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 files/ko/mozilla/add-ons/webextensions/user_actions/index.html (limited to 'files/ko/mozilla/add-ons/webextensions/user_actions') diff --git a/files/ko/mozilla/add-ons/webextensions/user_actions/index.html b/files/ko/mozilla/add-ons/webextensions/user_actions/index.html new file mode 100644 index 0000000000..84a7210eef --- /dev/null +++ b/files/ko/mozilla/add-ons/webextensions/user_actions/index.html @@ -0,0 +1,43 @@ +--- +title: 사용자 행동 +slug: Mozilla/Add-ons/WebExtensions/User_actions +translation_of: Mozilla/Add-ons/WebExtensions/User_actions +--- +
{{AddonSidebar}}
+ +

Some WebExtension APIs perform functions that are generally performed as a result of a user action. For example:

+ + + +

To follow the principle of "no surprises", APIs like this can only be called from inside the handler for a user action. User actions include the following:

+ + + +

For example:

+ +
function handleClick() {
+  browser.sidebarAction.open();
+}
+
+browser.browserAction.onClicked.addListener(handleClick);
+ +

Note that user actions in normal web pages are not treated as user actions for this purpose. For example, if a user clicks a button in a normal web page, and a content script has added a click handler for that button and in that handler sends a message to the extension's background page, then the background page message handler is not considered to be handling a user action.

+ +

Also, if a user input handler waits on a promise, then its status as a user input handler is lost. For example:

+ +
async function handleClick() {
+  let result = await someAsyncFunction();
+
+  // this will fail, because the handler lost its "user action handler" status
+  browser.sidebarAction.open();
+}
+
+browser.browserAction.onClicked.addListener(handleClick);
-- cgit v1.2.3-54-g00ecf