Callbacks
WProofreader provides callback functions for tracking events and integrating with your application logic. All callbacks are set in the configuration alongside other options.
onLoad
WProofreader is loaded and ready to use.
onToggle
WProofreader is enabled or disabled.
onCommitOptions
A user changes options like lang, ignoreAllCapsWords, ignoreDomainNames, ignoreWordsWithMixedCases, or ignoreWordsWithNumbers.
onAddWordToUserDictionary
A word is added to the user dictionary.
onDeleteWordFromUserDictionary
A word is deleted from the user dictionary.
onCheckStatusChange
Text checking starts or finishes. Returns 'start' or 'finish'. Multiple cycles can occur due to asynchronous requests.
onStatistics
A user interacts with a suggestion or dictionary (replace, ignore, add, delete, report, disable, accept, discard, mismatch, generate).
onUsage
A check, autocorrect, autocomplete, or generate request is executed. Useful for monitoring usage and client-side analytics.
onErrorRequest
A request ends with an error.
onStatistics
The onStatistics callback is triggered whenever a user interacts with a suggestion or dictionary. It captures the action type, input text, and metadata such as rule, language, and context.
Actions:
replace
User accepted a suggestion and replaced the original text.
ignore
User ignored a suggestion.
add
Word was added to the user dictionary.
delete
Word was removed from the user dictionary.
report
User reported a suggestion as incorrect.
disable
User disabled the rule behind a suggestion.
accept
User accepted an autocomplete suggestion.
discard
Autocomplete suggestion was dismissed without interaction.
mismatch
Autocomplete suggestion didn't match user input.
generate
User used a suggestion from the AI writing assistant.
Suggestion types returned in data.type: spelling, grammar, style, autocomplete, autocorrect.
For callback signatures and full parameter details, refer to the Configuration reference.
Last updated
Was this helpful?

