The private API
The private API methods are only accessible via the closured _converse object, which is only available to plugins.
These methods are kept private (i.e. not global) because they may return sensitive data which should be kept off-limits to other 3rd-party scripts that might be running in the page.
Namespaces
- archive
- archive
- connection
- connection
- contacts
- contacts
- controlbox
- listen
- listen
- modal
- omemo
- promises
- promises
- pubsub
- pubsub
- settings
- settings
- user
- user
- vcard
- vcard
Methods
(static) alert(type, title, messages)
Show an alert modal to the user.
Parameters:
Name | Type | Description |
---|---|---|
type |
'info' | 'warn' | 'error' | The type of alert. |
title |
String | The header text for the alert. |
messages |
Array.<String> | String | The alert text to show to the user. |
- Source:
(static) confirm(title, messages, fields) → {Promise.<(Array|false)>}
Show a confirm modal to the user.
Parameters:
Name | Type | Description |
---|---|---|
title |
String | The header text for the confirmation dialog |
messages |
Array.<String> | String | The text to show to the user |
fields |
Array.<Field> | An object representing a fields presented to the user. |
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
Field.label |
String | The form label for the input field. |
|
Field.name |
String | The name for the input field. |
|
Field.challenge |
String |
<optional> |
A challenge value that must be provided by the user. |
Field.placeholder |
String |
<optional> |
The placeholder for the input field. |
Field.required |
Boolean |
<optional> |
Whether the field is required or not |
- Source:
Returns:
A promise which resolves with an array of
filled in fields or false
if the confirm dialog was closed or canceled.
- Type
- Promise.<(Array|false)>
(async, static) hook(name, …context, …data) → {Promise.<any>}
Triggers a hook which can be intercepted by registered listeners via _converse.api.listen.on or _converse.api.listen.once. (see _converse.api.listen). A hook is a special kind of event which allows you to intercept a data structure in order to modify it, before passing it back.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string | The hook name |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
context |
any |
<repeatable> |
The context to which the hook applies (could be for example, a false)> Show a prompt modal to the user. Parameters:
Returns:A promise which resolves with the text provided by the
user or
(static) send(stanza) → {void}Allows you to send XML stanzas. Parameters:
Returns:
Example
(static) send(stanza) → {void}Allows you to send XML stanzas. Parameters:
Returns:
Example
(static) sendIQ(stanza, timeoutopt, rejectopt) → {Promise}Send an IQ stanza Parameters:
Returns:A promise which resolves (or potentially rejected) once we
receive a
(static) sendIQ(stanza, timeoutopt, rejectopt) → {Promise}Send an IQ stanza Parameters:
Returns:A promise which resolves (or potentially rejected) once we
receive a
(static) trigger(name, …argumentopt, optionsopt)Lets you trigger events, which can be listened to via _converse.api.listen.on or _converse.api.listen.once (see _converse.api.listen). Some events also double as promises and can be waited on via _converse.api.waitUntil. Parameters:
(static) trigger(name, …argumentopt, optionsopt)Lets you trigger events, which can be listened to via _converse.api.listen.on or _converse.api.listen.once (see _converse.api.listen). Some events also double as promises and can be waited on via _converse.api.waitUntil. Parameters:
(static) waitUntil(condition) → {Promise}Wait until a promise is resolved or until the passed in function returns a truthy value. Parameters:
Returns:
(static) waitUntil(condition) → {Promise}Wait until a promise is resolved or until the passed in function returns a truthy value. Parameters:
Returns:
_converse.apiThe private APIThe private API methods are only accessible via the closured _converse object, which is only available to plugins. These methods are kept private (i.e. not global) because they may return sensitive data which should be kept off-limits to other 3rd-party scripts that might be running in the page.
Namespaces
Methods(static) alert(type, title, messages)Show an alert modal to the user. Parameters:
(static) confirm(title, messages, fields) → {Promise.<(Array|false)>}Show a confirm modal to the user. Parameters:
Properties:
Returns:A promise which resolves with an array of
filled in fields or
(async, static) hook(name, …context, …data) → {Promise.<any>}Triggers a hook which can be intercepted by registered listeners via _converse.api.listen.on or _converse.api.listen.once. (see _converse.api.listen). A hook is a special kind of event which allows you to intercept a data structure in order to modify it, before passing it back. Parameters:
|