Constructor
new mw.editcheck.AsyncTextCheck(controller, [config])
#
Abstract class for async checks that run on the plain text of a ContentBranchNode.
The check runs when selection focus changes branch node, or on pre-save. The subclass
implements .checkAsync. This is called with the ContentBranchNode's plain text
and returns an outcome, which gets processed by the subclass's .newAction method,
returning a new EditCheckAction if appropriate.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
controller |
|||
config |
Object |
optional |
Properties
newAction
#
Build an action (or not), depending on the outcome of #checkAsync
Caution: The ContentBranchNode may have changed while waiting for #checkAsync to settle. For example, the fragment could be empty if the ContentBranchNode has been deleted.
Build an action (or not), depending on the outcome of #checkAsync
Caution: The ContentBranchNode may have changed while waiting for #checkAsync to settle.
checkAsyncabstractstatic
#
Perform a possibly-asynchronous check on the plaintext of a ContentBranchNode.
The check must be deterministic; i.e. it must always return the same value for the same arguments. This allows the result to be memoized.
memoizedCheckAsyncstatic
#
This static method gets implemented inside the AsyncTextCheck constructor. It
memoizes the subclass's static method checkAsync.
Methods
act()
#
afterMemoized(outcome) → {any}
#
A filter to apply after the memoized call has occurred
This is where instance-specific configuration would be applied
Parameters:
| Name | Type | Description |
|---|---|---|
outcome |
any | The outcome returned by #checkAsync |
Returns:
- Type
- any
A filter to apply after the memoized call has occurred
This is where instance-specific configuration would be applied
checkText(text, [bypass]) → {Promise}
#
Check provided text
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
text |
string | ||
bypass |
boolean |
optional |
Whether to bypass any memoized result |
Returns:
- Type
- Promise
handleListener(listener, surfaceModel) → {Array.<Promise>}
#
Parameters:
| Name | Type | Description |
|---|---|---|
listener |
string | Type of listener, such as 'onBeforeSave' or 'onBranchNodeChange' |
surfaceModel |
ve.dm.Surface | The surface |
Returns:
An array of promises containing either an action or null