algorithm - Text difference patch -
Trying to write a piece of code that will allow the user to type in the text box which is then saved on the server goes . When the user writes some more text in the text box, then I should only want the difference to be sent to the server
Is there any difference algorithm for JS that I can use to only send information about the difference I am So it should basically be able to tell the difference between the two text boxes.
This language can also be agnostic and I can turn it off.
Thank you for your time.
>UPDATE
In simple words, I have a text area that saves text in every x second in the box. To save bandwidth now, I only want to send the difference with the last saved revisions (which I can put in a variable. Initially it will be empty). Now JS will see the difference between the last revision and the current state of the text box and a change list will be prepared to send to the server.
Update 2
Something like www.etherpad.com
Google DiffMatchPatch has a JavaScript implementation, I've used it very successfully.
Comments
Post a Comment