dom/events/nsIEventListenerService.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/events/nsIEventListenerService.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,106 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +interface nsIDOMEventListener;
    1.12 +interface nsIDOMEventTarget;
    1.13 +
    1.14 +/**
    1.15 + * An instance of this interface describes how an event listener
    1.16 + * was added to an event target.
    1.17 + */
    1.18 +[scriptable, uuid(c4776eb7-05bc-49ce-a0ca-6213a346d53a)]
    1.19 +interface nsIEventListenerInfo : nsISupports
    1.20 +{
    1.21 +  /**
    1.22 +   * The type of the event for which the listener was added.
    1.23 +   * Null if the listener is for all the events.
    1.24 +   */
    1.25 +  readonly attribute AString type;
    1.26 +  readonly attribute boolean capturing;
    1.27 +  readonly attribute boolean allowsUntrusted;
    1.28 +  readonly attribute boolean inSystemEventGroup;
    1.29 +
    1.30 +  /**
    1.31 +   * The underlying JS object of the event listener, if this listener
    1.32 +   * has one.  Null otherwise.
    1.33 +   */
    1.34 +  [implicit_jscontext]
    1.35 +  readonly attribute jsval listenerObject;
    1.36 +
    1.37 +  /**
    1.38 +   * Tries to serialize event listener to a string.
    1.39 +   * Returns null if serialization isn't possible
    1.40 +   * (for example with C++ listeners).
    1.41 +   */
    1.42 +  AString toSource();
    1.43 +
    1.44 +  /**
    1.45 +   * If jsdIDebuggerService is active and the listener is implemented in JS,
    1.46 +   * this returns the listener as a jsdIValue. Otherwise null.
    1.47 +   */
    1.48 +  nsISupports getDebugObject();
    1.49 +};
    1.50 +
    1.51 +[scriptable, uuid(f6964bfb-dabe-4cab-9733-be0ee2bf8171)]
    1.52 +interface nsIEventListenerService : nsISupports
    1.53 +{
    1.54 +  /**
    1.55 +   * Returns an array of nsIEventListenerInfo objects.
    1.56 +   * If aEventTarget doesn't have any listeners, this returns null.
    1.57 +   */
    1.58 +  void getListenerInfoFor(in nsIDOMEventTarget aEventTarget,
    1.59 +                          [optional] out unsigned long aCount,
    1.60 +                          [retval, array, size_is(aCount)] out
    1.61 +                            nsIEventListenerInfo aOutArray);
    1.62 +
    1.63 +  /**
    1.64 +   * Returns an array of event targets.
    1.65 +   * aEventTarget will be at index 0.
    1.66 +   * The objects are the ones that would be used as DOMEvent.currentTarget while
    1.67 +   * dispatching an event to aEventTarget
    1.68 +   * @note Some events, especially 'load', may actually have a shorter
    1.69 +   *       event target chain than what this methods returns.
    1.70 +   */
    1.71 +  void getEventTargetChainFor(in nsIDOMEventTarget aEventTarget,
    1.72 +                              [optional] out unsigned long aCount,
    1.73 +                              [retval, array, size_is(aCount)] out
    1.74 +                                nsIDOMEventTarget aOutArray);
    1.75 +
    1.76 +  /**
    1.77 +   * Returns true if a event target has any listener for the given type.
    1.78 +   */
    1.79 +  boolean hasListenersFor(in nsIDOMEventTarget aEventTarget,
    1.80 +                          in DOMString aType);
    1.81 +
    1.82 +  /**
    1.83 +   * Add a system-group eventlistener to a event target.
    1.84 +   */
    1.85 +  void addSystemEventListener(in nsIDOMEventTarget target,
    1.86 +                              in DOMString type,
    1.87 +                              in nsIDOMEventListener listener,
    1.88 +                              in boolean useCapture);
    1.89 +
    1.90 +  /**
    1.91 +   * Remove a system-group eventlistener from a event target.
    1.92 +   */
    1.93 +  void removeSystemEventListener(in nsIDOMEventTarget target,
    1.94 +                                 in DOMString type,
    1.95 +                                 in nsIDOMEventListener listener,
    1.96 +                                 in boolean useCapture);
    1.97 +
    1.98 +  void addListenerForAllEvents(in nsIDOMEventTarget target,
    1.99 +                               in nsIDOMEventListener listener,
   1.100 +                               [optional] in boolean aUseCapture,
   1.101 +                               [optional] in boolean aWantsUntrusted,
   1.102 +                               [optional] in boolean aSystemEventGroup);
   1.103 +
   1.104 +  void removeListenerForAllEvents(in nsIDOMEventTarget target,
   1.105 +                                  in nsIDOMEventListener listener,
   1.106 +                                  [optional] in boolean aUseCapture,
   1.107 +                                  [optional] in boolean aSystemEventGroup);
   1.108 +};
   1.109 +

mercurial