Create and initialize a new Handler.
A function to be executed when the handler is run.
Optionalns: string
The namespace to match.
Optionalname: string
The element name to match.
Optionaltype: string | string[]
The stanza type (or types if an array) to match.
Optionalid: string
The element id attribute to match.
Optionalfrom: string
The element from attribute to match.
Optionaloptions: HandlerOptions
Handler options
Returns the XML namespace of an element.
Resolved via Strophe.getNamespace, which reads the xmlns
attribute and falls back to namespaceURI so matching works regardless
of how the stanza's DOM was built (locally, via DOMParser, or via the
component transport's createElementNS).
If ignoreNamespaceFragment was passed in for this handler, then the
URL fragment will be stripped.
The XML element with the namespace.
The namespace, with optionally the fragment stripped.
Tests if a stanza matches the Handler.
The XML element to test.
true if the stanza matches and false otherwise.
Tests if a stanza element (or any of its children) matches the namespace set for this Handler.
The XML element to test.
true if the stanza matches and false otherwise.
Run the callback on a matching stanza.
The DOM element that triggered the Handler.
A boolean indicating if the handler should remain active.
Get a String representation of the Handler object.
Private helper class for managing stanza handlers.
A Handler encapsulates a user provided callback function to be executed when matching stanzas are received by the connection. Handlers can be either one-off or persistant depending on their return value. Returning true will cause a Handler to remain active, and returning false will remove the Handler.
Users will not use Handler objects directly, but instead they will use Connection.addHandler and Connection.deleteHandler.