且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在sessionStorage中保存Javascript对象

更新时间:2023-12-04 21:10:46

您可以使用Web Storage API提供的访问器,也可以编写包装器/适配器。从你声明的问题来看,defineGetter / defineSetter听起来像编写包装器/适配器对你来说太多了。

Either you can use the accessors provided by the Web Storage API or you could write a wrapper/adapter. From your stated issue with defineGetter/defineSetter is sounds like writing a wrapper/adapter is too much work for you.

老实说,我不知道该告诉你什么。也许你可以重新评估你对什么是荒谬的限制的看法。 Web Storage API就是它应该是的一个键/值存储。

I honestly don't know what to tell you. Maybe you could reevaluate your opinion of what is a "ridiculous limitation". The Web Storage API is just what it's supposed to be, a key/value store.