docs-es | : black_joker : Un generador mágico
kandi X-RAY | docs-es Summary
kandi X-RAY | docs-es Summary
:black_joker: Un generador mágico de sitios de documentación
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of docs-es
docs-es Key Features
docs-es Examples and Code Snippets
Community Discussions
Trending Discussions on docs-es
QUESTION
I'm writing a text editing app with Node.js & express and want to achieve Google Docs-esque auto-saving whenever the user edits their text.
Currently I'm doing this by saving to the database with AJAX whenever the user presses a key within the textarea. As soon as I start typing at any decent speed the saving process freezes up and doesn't save most of the content. This however works perfectly when typing slowly. I'm currently using mLab, MongoDB hosting, could this be the problem?
In fact, what is the best way to handle this task?
edit.ejs (front-end js):
...ANSWER
Answered 2019-Apr-01 at 05:52Okay, two things here. firstly, it isn't a good idea to update your DB on every keystroke. Think about it. You are making a post request to your server more than once in a second with a payload and touching DB. Not ideal. So either you keep this data cached and save it once it crosses a threshold (say after one paragraph or X number of characters) or,
secondly, you can do some tweaks at the front-end side also here. Make sure you catch only valid or wanted keystrokes. Use reactive programming. Check for Rxjs and filter out invalid characters or catch only at a certain interval. Hope this will help.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install docs-es
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page