aboutsummaryrefslogtreecommitdiff
path: root/files/fa/web/api/notification/requestpermission/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/fa/web/api/notification/requestpermission/index.html')
-rw-r--r--files/fa/web/api/notification/requestpermission/index.html80
1 files changed, 0 insertions, 80 deletions
diff --git a/files/fa/web/api/notification/requestpermission/index.html b/files/fa/web/api/notification/requestpermission/index.html
deleted file mode 100644
index c9bd799f25..0000000000
--- a/files/fa/web/api/notification/requestpermission/index.html
+++ /dev/null
@@ -1,80 +0,0 @@
----
-title: Notification.requestPermission()
-slug: Web/API/Notification/requestPermission
-translation_of: Web/API/Notification/requestPermission
----
-<p>{{APIRef("Web Notifications")}}{{AvailableInWorkers}}{{securecontext_header}}</p>
-
-<p>The <strong><code>requestPermission()</code></strong> method of the {{domxref("Notification")}} interface requests permission from the user for the current origin to display notifications.</p>
-
-<div class="note">
-<p><strong>Note:</strong> This feature is <strong>not</strong> available in {{domxref("SharedWorker")}}</p>
-</div>
-
-<h2 id="Syntax">Syntax</h2>
-
-<p>The latest spec has updated this method to a promise-based syntax that works like this:</p>
-
-<pre class="brush: js">Notification.requestPermission().then(function(permission) { ... });</pre>
-
-<p>Previously, the syntax was based on a simple callback; this version is now deprecated:</p>
-
-<pre class="brush: js line-numbers language-js"><code class="language-js">Notification<span class="punctuation token">.</span><span class="function token">requestPermission</span><span class="punctuation token">(</span>callback<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre>
-
-<p><code class="language-js"><span class="punctuation token">Safari Version 12.0.3 still uses callback to get the permission.</span></code></p>
-
-<h3 id="Parameters">Parameters</h3>
-
-<dl>
- <dt><code>callback</code> {{optional_inline}} {{deprecated_inline("gecko46")}}</dt>
- <dd>An optional callback function that is called with the permission value. Deprecated in favor of the promise return value.</dd>
-</dl>
-
-<h3 id="Returns">Returns</h3>
-
-<p>A {{jsxref("Promise")}} that resolves to a {{domxref("DOMString")}} with the permission picked by the user. Possible values for this string are <code>granted</code>, <code>denied</code>, or <code>default</code>.</p>
-
-<h2 id="Example">Example</h2>
-
-<p>The following snippet requests permission from the user, then logs a different result to the console depending on the user's choice.</p>
-
-<pre class="brush: js">Notification.requestPermission().then(function(result) {
- if (result === 'denied') {
- console.log('Permission wasn\'t granted. Allow a retry.');
- return;
- }
- if (result === 'default') {
- console.log('The permission request was dismissed.');
- return;
- }
- // Do something with the granted permission.
-});</pre>
-
-<h2 id="Specifications">Specifications</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Specification</th>
- <th scope="col">Status</th>
- <th scope="col">Comment</th>
- </tr>
- <tr>
- <td>{{SpecName('Web Notifications')}}</td>
- <td>{{Spec2('Web Notifications')}}</td>
- <td>Living standard</td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browser_compatibility">Browser compatibility</h2>
-
-
-
-<p>{{Compat("api.Notification.requestPermission")}}</p>
-
-<h2 id="See_also">See also</h2>
-
-<ul>
- <li><a href="/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API">Using the Notifications API</a></li>
-</ul>