1 /*
2 * Copyright (c) 2002-2025 Gargoyle Software Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * https://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 package org.htmlunit.javascript.host;
16
17 import static org.htmlunit.javascript.configuration.SupportedBrowser.CHROME;
18 import static org.htmlunit.javascript.configuration.SupportedBrowser.EDGE;
19
20 import org.htmlunit.corejs.javascript.Scriptable;
21 import org.htmlunit.javascript.configuration.JsxClass;
22 import org.htmlunit.javascript.configuration.JsxConstant;
23 import org.htmlunit.javascript.configuration.JsxConstructor;
24 import org.htmlunit.javascript.configuration.JsxStaticFunction;
25 import org.htmlunit.javascript.configuration.JsxStaticGetter;
26 import org.htmlunit.javascript.host.event.EventTarget;
27
28 /**
29 * A Notification.
30 *
31 * @see <a href="https://developer.mozilla.org/en/docs/Web/API/notification">
32 * MDN - Notification</a>
33 * @author Marc Guillemot
34 * @author Ronald Brill
35 * @author Ahmed Ashour
36 */
37 @JsxClass
38 public class Notification extends EventTarget {
39
40 /**
41 * The maximum number of actions supported.
42 */
43 @JsxConstant({CHROME, EDGE})
44 public static final int maxActions = 2;
45
46 /**
47 * JavaScript constructor.
48 * @param title the title
49 */
50 @JsxConstructor
51 public void jsConstructor(final String title) {
52 // Empty.
53 }
54
55 /**
56 * Returns the {@code permission} static property.
57 * @param thisObj the scriptable
58 * @return the {@code permission} static property
59 */
60 @JsxStaticGetter
61 public static String getPermission(final Scriptable thisObj) {
62 return "default";
63 }
64
65 /**
66 * Asks the user for permission.
67 */
68 @JsxStaticFunction
69 public static void requestPermission() {
70 // TODO
71 }
72 }