Class NativeBaseEvent

  • All Implemented Interfaces:
    IsJSType, IsCastable
    Direct Known Subclasses:
    NativeCustomEvent, NativeUIEvent

    @JsType(isNative=true,
            name="Event",
            namespace="<global>")
    public abstract class NativeBaseEvent
    extends Object
    implements IsCastable
    Represents an base event which takes place in the DOM.
    There are many types of events, some of which use other interfaces based on the main event interface.
    Event itself contains the properties and methods which are common to all events.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • isBubbles

        @JsProperty
        public final boolean isBubbles()
        Returns true indicates whether the event bubbles up through the DOM tree or not.
        Returns:
        true indicates whether the event bubbles up through the DOM tree or not
      • isCancelable

        @JsProperty
        public final boolean isCancelable()
        Returns true indicates whether the event can be canceled, and therefore prevented as if the event never happened.
        If the event is not cancelable, then its cancelable property will be false and the event listener cannot stop the event from occurring.
        Returns:
        true indicates whether the event can be canceled, and therefore prevented as if the event never happened
      • getCurrentTarget

        @JsProperty
        public final BaseEventTarget getCurrentTarget()
        Returns a reference to the currently registered target for the event.
        This is the object to which the event is currently slated to be sent.
        Returns:
        a reference to the currently registered target for the event
      • isDefaultPrevented

        @JsProperty
        public final boolean isDefaultPrevented()
        Indicates whether or not the call to preventDefault() canceled the event.
        Returns:
        Indicates whether or not the call to preventDefault() canceled the event
      • getTarget

        @JsProperty
        public final BaseEventTarget getTarget()
        Returns a reference to the target to which the event was originally dispatched.
        Returns:
        a reference to the target to which the event was originally dispatched
      • getType

        @JsProperty
        public final String getType()
        Returns the type of the event.
        Returns:
        the type of the event
      • preventDefault

        @JsMethod
        public final void preventDefault()
        Cancels the event (if it is cancelable).
      • stopImmediatePropagation

        @JsMethod
        public final void stopImmediatePropagation()
        Prevents all other listeners from being called.
      • stopPropagation

        @JsMethod
        public final void stopPropagation()
        Stops the propagation of events further along in the DOM.
      • createEvent

        @JsOverlay
        public static final NativeBaseEvent createEvent​(String type)
        Creates a new event object for a specific event type.
        Parameters:
        type - type of event
        Returns:
        a new event object for a specific event type
      • createEvent

        @JsOverlay
        public static final NativeBaseEvent createEvent​(IsEvent type)
        Creates a new event object for a specific event type.
        Parameters:
        type - type of event
        Returns:
        a new event object for a specific event type
      • createEvent

        @JsOverlay
        public static final NativeBaseEvent createEvent​(IsEvent type,
                                                        EventInit init)
        Creates a new event object for a specific event type with initial configuration.
        Parameters:
        type - type of event
        init - initial configuration of the event
        Returns:
        a new event object for a specific event type
      • createEvent

        @JsOverlay
        public static final NativeBaseEvent createEvent​(String type,
                                                        EventInit init)
        Creates a new event object for a specific event type with initial configuration.
        Parameters:
        type - type of event
        init - initial configuration of the event
        Returns:
        a new event object for a specific event type
      • getEventPhase

        @JsOverlay
        public final EventPhase getEventPhase()
        Returns which phase of the event flow is currently being evaluated.
        Returns:
        which phase of the event flow is currently being evaluated