Constructor
new CommentFormOperation(registry, type, options)
Parameters:
Name | Type | Description |
---|---|---|
registry |
CommentFormOperationRegistry | Operation registry. |
type |
'load' | 'preview' | 'viewChanges' | 'submit' | Operation type. |
options |
object |
Methods
close()
Mark the operation as closed if it is not; unregister it. Should be done when an operation has finished (either successfully or not).
delay()
Mark the operation as delayed.
getDate() → {Date}
Get the date of the operation.
Returns:
- Type
- Date
getOption(name) → {*}
Get the value of an option.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Option name. |
Returns:
- Type
- *
getType() → {'load'|'preview'|'viewChanges'|'submit'}
Get the type of the operation.
Returns:
- Type
- 'load' | 'preview' | 'viewChanges' | 'submit'
isClosed() → {boolean}
Check whether the operation is closed (settled).
Returns:
- Type
- boolean
isDelayed() → {boolean}
Check whether the operation is delayed.
Returns:
- Type
- boolean
maybeClose() → {boolean}
Check for conflicts of the operation with other pending operations, and if there are such,
close the operation and return true
to abort it.
The rules are the following:
preview
andviewChanges
operations can be overriden with other of one of these types (every new request replaces the old, although a new automatic preview request cannot be made while the old is pending).submit
operations cannot be overriden (and are not checked by this function), but also don't override existingpreview
andviewChanges
operations (so that the user gets the last autopreview even after they have sent the comment).
For convenience, can also check for an arbitrary condition and close the operation if it is
true
.
Returns:
- Type
- boolean
open(clearMessages)
Mark the operation as open (run after its creation).
Parameters:
Name | Type | Description |
---|---|---|
clearMessages |
boolean | Whether to clear the messages above the comment form. |
undelay()
Unmark the operation as delayed.