For this homework you will write code that deals gracefully with the problem of a user going online/offline while editing a question text. In the current implementation of a question editing session you are doing an XHR request whenever the user clicks on the 'save' button (or, goes out of focus). But, what happens if the user is offline at that moment?
One use case you will implement is the following.
- The user goes to his questions at /123.
- He goes offline: unplugs his ethernet cable and turns off wi-fi.
- He goes back to his browser and edits the question at /123
- He shuts off the browser.
- He goes back online.
- He starts his browser and visits
/123
. - The page should show the question as it was before he turned off the browser, including all his changes. The page will also immediately try again to do an XHR update of the new question.
You will implement this using the localStorage object. In class, I will explain more on how to achieve this effect.
Required Reading
This homework is due on Wednesday, April 13 @11am. You can turn it in here
No comments:
Post a Comment