Bug 1032573 part 4 - Add AnimationTimeline::ToTimelineTime helper method; r=dbaron
[gecko.git] / dom / events / nsIEventListenerService.idl
blobab85b98472a07656e48d1bb662e7d3272416f8cc
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 interface nsIDOMEventListener;
9 interface nsIDOMEventTarget;
11 /**
12 * An instance of this interface describes how an event listener
13 * was added to an event target.
15 [scriptable, uuid(11ba5fd7-8db2-4b1a-9f67-342cfa11afad)]
16 interface nsIEventListenerInfo : nsISupports
18 /**
19 * The type of the event for which the listener was added.
20 * Null if the listener is for all the events.
22 readonly attribute AString type;
23 readonly attribute boolean capturing;
24 readonly attribute boolean allowsUntrusted;
25 readonly attribute boolean inSystemEventGroup;
27 /**
28 * The underlying JS object of the event listener, if this listener
29 * has one. Null otherwise.
31 [implicit_jscontext]
32 readonly attribute jsval listenerObject;
34 /**
35 * Tries to serialize event listener to a string.
36 * Returns null if serialization isn't possible
37 * (for example with C++ listeners).
39 AString toSource();
42 [scriptable, uuid(f6964bfb-dabe-4cab-9733-be0ee2bf8171)]
43 interface nsIEventListenerService : nsISupports
45 /**
46 * Returns an array of nsIEventListenerInfo objects.
47 * If aEventTarget doesn't have any listeners, this returns null.
49 void getListenerInfoFor(in nsIDOMEventTarget aEventTarget,
50 [optional] out unsigned long aCount,
51 [retval, array, size_is(aCount)] out
52 nsIEventListenerInfo aOutArray);
54 /**
55 * Returns an array of event targets.
56 * aEventTarget will be at index 0.
57 * The objects are the ones that would be used as DOMEvent.currentTarget while
58 * dispatching an event to aEventTarget
59 * @note Some events, especially 'load', may actually have a shorter
60 * event target chain than what this methods returns.
62 void getEventTargetChainFor(in nsIDOMEventTarget aEventTarget,
63 [optional] out unsigned long aCount,
64 [retval, array, size_is(aCount)] out
65 nsIDOMEventTarget aOutArray);
67 /**
68 * Returns true if a event target has any listener for the given type.
70 boolean hasListenersFor(in nsIDOMEventTarget aEventTarget,
71 in DOMString aType);
73 /**
74 * Add a system-group eventlistener to a event target.
76 void addSystemEventListener(in nsIDOMEventTarget target,
77 in DOMString type,
78 in nsIDOMEventListener listener,
79 in boolean useCapture);
81 /**
82 * Remove a system-group eventlistener from a event target.
84 void removeSystemEventListener(in nsIDOMEventTarget target,
85 in DOMString type,
86 in nsIDOMEventListener listener,
87 in boolean useCapture);
89 void addListenerForAllEvents(in nsIDOMEventTarget target,
90 in nsIDOMEventListener listener,
91 [optional] in boolean aUseCapture,
92 [optional] in boolean aWantsUntrusted,
93 [optional] in boolean aSystemEventGroup);
95 void removeListenerForAllEvents(in nsIDOMEventTarget target,
96 in nsIDOMEventListener listener,
97 [optional] in boolean aUseCapture,
98 [optional] in boolean aSystemEventGroup);