Open creage opened 12 years ago
Hi!
The TTL for the localStorage is wonder, and was missing in the previous version. So, this is perfect.
However a few questions for you:
Once I am clear with these things, I will merge these modifications.
.ms provides more convenient way to set the expiration of data.
By default, original $.cookie respects only days, meaning there is no way to set a cookie for one hour, except of compute that and pass as Date object.
Using $.ms users can set any timeout in more intuitive way - $.ms("1h") means one hour TTL, $.ms("7d") means one week, etc. This brings more value while setting TTL.
Additionally, I've minified options names, to save bytes, and keep code clean. Personally I don't like kindOfVeryLongVariableNamesIntendedToBeSelfExplaining. I love following KISS principle.
Hi Creage!
Good for $.ms, and thanks for the explanation.
About the naming of the variables, the minding is the following: better knowing what the variable (in this case the option) is about by reading it. I share the same view as Robert C. Marting here. I agree that "kindOfVeryLongVariableNamesIntendedToBeSelfExplaining" doesn't make it, but I think that having (shorter) variable names, but still self explaining, makes reading and understanding the code much easier.
Finally, to save bytes, we are better minifying the code on production servers than making the code more obscure to the developers.
If you don't mind, I would strongly suggest keeping the previous options names; particularly since they are options more than inner code variables.
Thoughts?
The TTL feature for localStorage is what I'm hardly missing about this great plugin, would be nice if this could be implemented soon =)!
Yeah, will have to check this. The problem was one of naming conventions. I would have to merge, fix and push I guess.
I'm not sure if the $.ms is wanted feature, but in my custom project it helps greatly, so I went to implement it in that plugin as well.
Apart of that, I've implemented a TTL (expiring) feature for localStorage items, and changed (minified) some API keys.