Table of Contents

Method CreateEvent

Namespace
SharpVectors.Dom.Events
Assembly
SharpVectors.Core.dll

CreateEvent(string)

The CreateEvent method is used in creating IEvents when it is either inconvenient or unnecessary for the user to create an IEvent themselves.

IEvent CreateEvent(string eventType)

Parameters

eventType string

The eventType parameter specifies the name of the DOM Events interface to be supported by the created event object, e.g. "Event", "MouseEvent", "MutationEvent" ... If the IEvent is to be dispatched via the IEventTarget.DispatchEvent method the appropriate event init method must be called after creation in order to initialize the IEvent's values. As an example, a user wishing to synthesize some kind of IUiEvent would call IDocumentEvent.CreateEvent with the parameter "UIEvent". The IUiEvent.InitUiEventNs method could then be called on the newly created IUiEvent object to set the specific type of user interface event to be dispatched, {"http://www.w3.org/2001/xml-events", "DOMActivate"} for example, and set its context information, e.g. IUiEvent.Detail in this example.

Returns

IEvent

The newly created event object.

Remarks

In cases where the implementation provided IEvent is insufficient, users may supply their own IEvent implementations for use with the IEventTarget.DispatchEvent method. However, the DOM implementation needs access to the attributes IEvent.CurrentTarget and IEvent.EventPhase to propagate appropriately the event in the DOM tree. Therefore users' IEvent implementations might need to support the ICustomEvent interface for that effect.

Note: For backward compatibility reason, "UIEvents", "MouseEvents", "MutationEvents", and "HTMLEvents" feature names are valid values for the parameter eventType and represent respectively the interfaces "UIEvent", "MouseEvent", "MutationEvent", and "Event".

Exceptions

DomException

NOT_SUPPORTED_ERR: Raised if the implementation does not support the Event interface requested.