localStorage和锁定 [英] localStorage and locking

查看:137
本文介绍了localStorage和锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于(html5)localStorage及其等效项持续存在于选项卡和窗口之间,因此我考虑过将其用于消息传递.问题在于,获取和存储是不同的操作,因此不是原子操作.我有依赖于UUID生成,冲突解决和信标的模型来完成我需要做的一小部分工作,但是我真正的问题是:

Since (html5) localStorage and its equivalencies persist in between tabs and windows, I've thought about using it for message passing. The problem is that fetch and store are different operations, and therefore not atomic. I have models that rely on UUID generation, conflict resolutions, and beaconing to do the small subset of what I need to do, but my real question is this:

由于本地存储是共享内存资源,因此可用于相互访问的锁定机制是什么?

Since the local storage is a shared memory resource, what are the locking mechanisms available for mutual access?

推荐答案

我认为您真正需要的是

I think what you really need is Channel Messaging, though as far as I'm aware no-one has implemented it yet. It allows arbitrary client side messaging between scripts.

这篇关于localStorage和锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆