title: How do I capture what to save if user is allowed to modify content during saving?
body: <p>I'm creating a TODO list web app and I have a question about how saving the contents of a list should be done. Just like any word processor, I want to allow user to modify data during saving.</p>
  
  <p>I can use a boolean variable to indicate that something was changed by user, ie. TRUE when something was changed, FALSE otherwise. Perhaps, this flag is also used to show user that some data is unsaved. When user saves data by, say pressing Ctrl+S, my app calls a function, then current data in the list is fetched and start saving it to database. At the end, the variable is changed to false. This seems straightforward, but there is an obvious pitfall with this approach. For example.</p>
  
  <ol>
  <li>User changes data. The boolean variable becomes TRUE.</li>
  <li>User presses Ctrl+S.</li>
  <li>A function is called and it retrieves current data and starts saving it.</li>
  <li>User changes more data during saving.</li>
  <li>The function finishes saving and sets the variable to FALSE.</li>
  </ol>
  
  <p>It is easy to see that the flag is set to FALSE as a result even if there is some unsaved data from Step 4. How do word processors/text editors handle this? Do they just disable inputs during saving, but it is quick enough that I don't see it??</p>