Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / events / nsIEventListenerService.idl
blobb8f36e5d0eb16ccc5bb74bcda2e33879db61d078
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsISupports.idl"
8 webidl EventTarget;
10 interface nsIArray;
12 /**
13 * Contains an event target along with a count of event listener changes
14 * affecting accessibility.
16 [scriptable, uuid(07222b02-da12-4cf4-b2f7-761da007a8d8)]
17 interface nsIEventListenerChange : nsISupports
19 readonly attribute EventTarget target;
21 [noscript]
22 readonly attribute uint32_t countOfEventListenerChangesAffectingAccessibility;
25 [scriptable, function, uuid(aa7c95f6-d3b5-44b3-9597-1d9f19b9c5f2)]
26 interface nsIListenerChangeListener : nsISupports
28 void listenersChanged(in nsIArray aEventListenerChanges);
31 /**
32 * An instance of this interface describes how an event listener
33 * was added to an event target.
35 [scriptable, uuid(11ba5fd7-8db2-4b1a-9f67-342cfa11afad)]
36 interface nsIEventListenerInfo : nsISupports
38 /**
39 * The type of the event for which the listener was added.
40 * Null if the listener is for all the events.
42 readonly attribute AString type;
43 readonly attribute boolean capturing;
44 readonly attribute boolean allowsUntrusted;
45 readonly attribute boolean inSystemEventGroup;
47 /**
48 * Changing the enabled state works only with listeners implemented in
49 * JS. An error is thrown for native listeners.
51 attribute boolean enabled;
53 /**
54 * The underlying JS object of the event listener, if this listener
55 * has one. Null otherwise.
57 [implicit_jscontext]
58 readonly attribute jsval listenerObject;
60 /**
61 * Tries to serialize event listener to a string.
62 * Returns null if serialization isn't possible
63 * (for example with C++ listeners).
65 AString toSource();
68 [scriptable, uuid(77aab5f7-213d-4db4-9f22-e46dfb774f15)]
69 interface nsIEventListenerService : nsISupports
71 /**
72 * Returns an array of nsIEventListenerInfo objects.
73 * If aEventTarget doesn't have any listeners, this returns null.
75 Array<nsIEventListenerInfo> getListenerInfoFor(in EventTarget aEventTarget);
77 /**
78 * Returns true if a event target has any listener for the given type.
80 boolean hasListenersFor(in EventTarget aEventTarget,
81 in AString aType);
83 [implicit_jscontext]
84 void addListenerForAllEvents(in EventTarget target,
85 in jsval listener,
86 [optional] in boolean aUseCapture,
87 [optional] in boolean aWantsUntrusted,
88 [optional] in boolean aSystemEventGroup);
90 [implicit_jscontext]
91 void removeListenerForAllEvents(in EventTarget target,
92 in jsval listener,
93 [optional] in boolean aUseCapture,
94 [optional] in boolean aSystemEventGroup);
96 void addListenerChangeListener(in nsIListenerChangeListener aListener);
97 void removeListenerChangeListener(in nsIListenerChangeListener aListener);