Back to reference

GrammarlyEditorPluginCallbacks

interface GrammarlyEditorPluginCallbacks {
  onDocumentStats?: (event: CustomEvent<DocumentStats>) => void;
  onPluginError?: (event: CustomEvent<Error>) => void;
  onPluginTurnedOff?: (event: CustomEvent) => void;
  onSessionStats?: (event: CustomEvent<SessionStats>) => void;
  onSuggestionCardClose?: (event: CustomEvent) => void;
  onSuggestionCardOpen?: (event: CustomEvent) => void;
}

Properties

onDocumentStatsoptionalType: (event: CustomEvent<DocumentStats>) => void

Triggered when new text information is available. This event can be used to track features of text as it is being written.

Since: v1.9.0

onPluginErroroptionalType: (event: CustomEvent<Error>) => void

Triggered on fatal error with the plugin.

Since: v1.9.0

onPluginTurnedOffoptionalType: (event: CustomEvent) => void

Triggered when the user turns off Grammarly.

Since: v1.9.0

onSessionStatsoptionalType: (event: CustomEvent<SessionStats>) => void

Triggered when new session information is available. This event can be used to track information about the writing session.

Since: v1.9.0

onSuggestionCardCloseoptionalType: (event: CustomEvent) => void

Triggered when a suggestion card is closed.

Since: v1.8.0

onSuggestionCardOpenoptionalType: (event: CustomEvent) => void

Triggered when a suggestion card is opened.

Since: v1.8.0

Last Updated: 10/14/2022, 5:57:08 PM