-
Notifications
You must be signed in to change notification settings - Fork 5
Improve call frequency #16
Conversation
src/autosave.js
Outdated
|
||
// A minimum amount of time that needs to pass after the last action. | ||
// After that time the provided save callbacks are being called. | ||
const waitingTime = config.waitingTime || 2000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After #12 (comment) default timeout should work in most cases and is should not need to be configurable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I am not sure if 2000 is not too much. Maybe 1000?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After #12 (comment) default timeout should work in most cases and it should not need to be configurable.
Right, I overlooked it.
Also, I am not sure if 2000 is not too much. Maybe 1000?
The last call will be on the Editor#destroy
or Window#beforeunload
, so IMO we can use a higher value here.
src/autosave.js
Outdated
} | ||
|
||
// Do nothing if the plugin is in `external-saving` state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment is needed that is will be handled based on the document version.
Suggested merge commit message (convention)
Other: Improved call frequency. Closes ckeditor/ckeditor5#2539. Closes ckeditor/ckeditor5#2541. Closes ckeditor/ckeditor5#2547. Closes ckeditor/ckeditor5#1158.
Additional information
This PR Introduces
Autosave#state
, which can have the following values:adapter#save()
andconfig.autosave.save()
It switches from
throttle
to lodash'sdebounce
It makes the timeout configurable