Autosaving Text Editor with JavaScript

I was looking for a simple JavaScript only auto-saving text editor, which would work smoothly with jQuery and Ajax calls.
After spending some time searching, decided to combine few existing pieces of code and write the rest from scratch.
This is a starting point and possibly can be improved in many ways. Please let me know your suggestions in the comments.

-Works with input and textarea items, by adding the class ‘InputContainer’
-A javascript save function can be defined for each item
-Automatically saves every 20 seconds of none-stop typing
-Automatically saves after 2 seconds of no typing
-Saves when clicked out of the text box
-Saves before closing the page
-Activates the autosave while typing and deactivates afterwards to avoid overloads
-Every save operation resets the timer to makes sure different autosave points don’t conflict or save too many times

View the demo
Download the source code or find it on GitHub.

Feel free to use/change the code as you need.
Thanks to Christian C. Salvadó for the typewatch code.