Skip to content

Commit

Permalink
feat: add method for manually retrieving the TextState
Browse files Browse the repository at this point in the history
In case you do something asynchronous inside a Command, e.g. starting an image upload it is necessary to get the state which could change between starting the asynchronous operation and finishing the asynchronous operation.
  • Loading branch information
n1ru4l authored Apr 12, 2020
1 parent fa27eec commit 50ac580
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/commandOrchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export class TextAreaTextApi implements TextApi {
this.textArea.selectionEnd = selection.end;
return getStateFromTextArea(this.textArea);
}

getState(): TextState {
return getStateFromTextArea(this.textArea);
}
}

export function getStateFromTextArea(textArea: HTMLTextAreaElement): TextState {
Expand Down

0 comments on commit 50ac580

Please sign in to comment.