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 import static org.htmlunit.javascript.configuration.SupportedBrowser.FF;
20
21 import org.htmlunit.corejs.javascript.Scriptable;
22 import org.htmlunit.javascript.configuration.JsxClass;
23 import org.htmlunit.javascript.configuration.JsxConstant;
24 import org.htmlunit.javascript.configuration.JsxConstructor;
25 import org.htmlunit.javascript.configuration.JsxStaticFunction;
26 import org.htmlunit.javascript.configuration.JsxStaticGetter;
27 import org.htmlunit.javascript.host.event.EventTarget;
28
29 /**
30 * A Notification.
31 *
32 * @see <a href="https://developer.mozilla.org/en/docs/Web/API/notification">
33 * MDN - Notification</a>
34 * @author Marc Guillemot
35 * @author Ronald Brill
36 * @author Ahmed Ashour
37 */
38 @JsxClass
39 public class Notification extends EventTarget {
40
41 /**
42 * The maximum number of actions supported.
43 */
44 @JsxConstant({CHROME, EDGE, FF})
45 public static final int maxActions = 2;
46
47 /**
48 * JavaScript constructor.
49 * @param title the title
50 */
51 @JsxConstructor
52 public void jsConstructor(final String title) {
53 // Empty.
54 }
55
56 /**
57 * Returns the {@code permission} static property.
58 * @param thisObj the scriptable
59 * @return the {@code permission} static property
60 */
61 @JsxStaticGetter
62 public static String getPermission(final Scriptable thisObj) {
63 return "default";
64 }
65
66 /**
67 * Asks the user for permission.
68 */
69 @JsxStaticFunction
70 public static void requestPermission() {
71 // TODO
72 }
73 }