简体   繁体   English

React中的离线模式

[英]Offline mode in React

I have a use case where we need to have an application which will operate in the user's pc in an offline mode, the user will do stuff and save then and at the end of the day, when she/he goes back to the office and enters the local network will be able to connect, authenticate and push/save the work done. 我有一个用例,我们需要有一个应用程序,它将在用户的PC上以离线模式运行,用户将执行操作然后保存,并在一天结束时,当他/他回到办公室时进入本地网络将能够连接,验证和推送/保存完成的工作。

I'm wondering whether is this possible with React framework, to work in an offline mode somehow and submit the work when the user reaches network? 我想知道是否可以使用React框架,以某种方式在离线模式下工作并在用户到达网络时提交工作? Maybe something like swarm? 也许像swarm这样的东西? http://swarmjs.github.io/articles/todomvc/ http://swarmjs.github.io/articles/todomvc/

I can install something like a client side application in the user's laptop/pc but is there any react way to sync local store or something similar with the server? 我可以在用户的​​笔记本电脑/ PC上安装类似客户端应用程序的东西,但有没有任何反应方式来同步本地存储或与服务器类似的东西?

I would use atom/electron on the client along with reflux. 我会在客户端使用原子/电子以及回流。 When starting I would make an ajax call that would attempt authentication and if successful would trigger the updates. 启动时,我会进行一次尝试身份验证的ajax调用,如果成功则会触发更新。 Otherwise it would just go along offline. 否则它只会离线。 An example using react with electron is at https://github.com/calitek/ReactPatterns React.14/ReFluxElectron. 使用与电子反应的一个例子是https://github.com/calitek/ReactPatterns React.14 / ReFluxElectron。

What you're talking about is write-resilience. 你所说的是写弹性。 This lib takes care of it: https://github.com/jevakallio/redux-offline 这个lib负责它: https//github.com/jevakallio/redux-offline

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM