Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created April 1, 2024 18:41
Show Gist options
  • Save bjoerntx/aa53c7183dfaff12804a70cf583c80fa to your computer and use it in GitHub Desktop.
Save bjoerntx/aa53c7183dfaff12804a70cf583c80fa to your computer and use it in GitHub Desktop.
function deleteCommentsByName(index, numComments, TXTextControl, name) {
if (index >= numComments) {
return;
}
TXTextControl.comments.elementAt(index, (comment) => {
comment.getUserName((author) => {
if (author === name) {
TXTextControl.comments.remove(comment, () => {
TXTextControl.comments.getCount((newNumComments) => {
deleteCommentsByName(0, newNumComments, TXTextControl, name);
});
});
} else {
deleteCommentsByName(index + 1, numComments, TXTextControl, name);
}
});
});
}
TXTextControl.comments.getCount((numComments) => {
deleteCommentsByName(0, numComments, TXTextControl, "Tim Typer");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment