A simple timer wrapper that is useful for implementing a delayed autosave in text-based applications, like Google Docs.
Install with component(1):
$ component install bmcmahen/auto-save
// 500 represents the timeout duration in ms.
var autosave = require('auto-save')(500);
var txt = document.getElementByTagName('textarea')[0];
txt.oninput = function(){
interval(function(){
console.log('do some saving.');
});
};
MIT