Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 11 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
严格来说,您无法仅使用一段 JavaScript 来完成此操作。服务器端需要某种持久副本,甚至是微型版本控制系统。 JavaScript 组件只会定期进行 AJAX 调用(基于任何标准……可能不是每次按键,否则效率非常低),这会同时获取其他人的更改。
Websocket 实现可能会更好,但 Websocket 仍然是一种相对未知且不受支持的商品。
You couldn't do this strictly with a piece of JavaScript. There will need to be some sort of persistent copy or even a micro versioning system on the server side. The JavaScript component would simply make AJAX calls (based on whatever criteria... probably not every keyup or that would be highly inefficient) periodically, which would simultaneously fetch other people's changes.
A websocket implementation could be even better, but websockets are still a relatively unknown and unsupported commodity.