Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Docs improvements for TextWatcher#isEnabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Jan 29, 2020
1 parent 0bbaeee commit 75b95bf
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/textwatcher.js
Expand Up @@ -19,14 +19,14 @@ import getLastTextLine from './utils/getlasttextline';
* {@link module:typing/textwatcher~TextWatcher#event:unmatched `unmatched`} events on typing or selection changes.
*
* @private
* @mixes module:utils/observablemixin~ObservableMixin
*/
export default class TextWatcher {
/**
* Creates a text watcher instance.
*
* @param {module:engine/model/model~Model} model
* @param {Function} testCallback The function used to match the text.
*
* @mixes module:utils/observablemixin~ObservableMixin
*/
constructor( model, testCallback ) {
this.model = model;
Expand All @@ -37,15 +37,14 @@ export default class TextWatcher {
* Flag indicating whether the TextWatcher is enabled or disabled.
* A disabled TextWatcher will not evaluate text.
*
* TextWatcher can be simply disabled like that:
* To disable TextWatcher:
*
* // Disable the TextWatcher so that it doesn't evaluate text.
* const watcher = new TextWatcher( editor.model, text => from.test( text ) );
* watcher.isEnabled = false;
* const watcher = new TextWatcher( editor.model, testCallback );
*
* // After this a testCallback will not be called.
* watcher.isEnabled = false;
*
* @observable
* @readonly
* @member {Boolean} #isEnabled
*/
this.set( 'isEnabled', true );
Expand Down

0 comments on commit 75b95bf

Please sign in to comment.