mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-23 01:44:31 -06:00
better debounce
This commit is contained in:
parent
825c65e204
commit
5db44ab734
@ -2037,7 +2037,8 @@ EasyMDE.prototype.render = function (el) {
|
|||||||
if (options.autosave != undefined && options.autosave.enabled === true) {
|
if (options.autosave != undefined && options.autosave.enabled === true) {
|
||||||
this.autosave(); // use to load localstorage content
|
this.autosave(); // use to load localstorage content
|
||||||
this.codemirror.on('change', function () {
|
this.codemirror.on('change', function () {
|
||||||
setTimeout(function () {
|
clearTimeout(self._autosave_timeout);
|
||||||
|
self._autosave_timeout = setTimeout(function () {
|
||||||
self.autosave();
|
self.autosave();
|
||||||
}, self.options.autosave.submit_delay || self.options.autosave.delay || 1000);
|
}, self.options.autosave.submit_delay || self.options.autosave.delay || 1000);
|
||||||
});
|
});
|
||||||
@ -2072,6 +2073,7 @@ function isLocalStorageAvailable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EasyMDE.prototype.autosave = function () {
|
EasyMDE.prototype.autosave = function () {
|
||||||
|
console.log('save');
|
||||||
if (isLocalStorageAvailable()) {
|
if (isLocalStorageAvailable()) {
|
||||||
var easyMDE = this;
|
var easyMDE = this;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user