window.localStorage上的原子操作 [英] atomic operation on window.localStorage

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

问题描述

设置两个或多个值时可以这样做吗?我正在使用phonegap,并担心用户可能会在应用程序设置完这两个值之前杀死该应用程序.

Is this possible to do when setting 2 or more values? I am using phonegap and concerned that the user could kill the app while before it finishes setting both values.

我意识到我可以在事务中使用W3C Web sql,但是我不想因为我在做什么而过度使用sql.

I realize that I could use W3C web sql with a transaction but didn't want the overkill of sql for what I am doing.

推荐答案

默认情况下,不,没有锁定机制.但是,您可能还想查看此问题,以及

By default, no, there is no locking mechanism. However, you may want to check out this question also, and this site that it references. You would be better off with a SQL transaction if persistence of those values in an atomic fashion is vital to your program.

这篇关于window.localStorage上的原子操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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