Rich-Harris/ramjet. Blowing up LocalStorage (or what happens when you exceed quota) Based on some discussion earlier today on Twitter, I wanted to take a quick look at what happens when you exceed the quota limit in a browser’s LocalStorage system.
I knew an error would be thrown, but I was curious about the type, message, etc. I built a quick test and threw some browsers at it. This probably isn’t the most scientific test, but here’s what I found. First, for my test I wanted a quick way to hit the “typical” limit of 5 megs per domain. To do that, I found an image of around one meg in size and then wrote code that would grab the binary bits, convert to base64, and then store it.
I’m using jQuery here, but I don’t really need to. The idea is simple – use XHR to fetch the bits of an image (hard coded to one on my test server), convert it to a DataURL and read in the base64 data. So – that’s it. Chrome 41 (OSX) Throws an exception with the name QuotaExceedError. Firefox 37 (OSX) Throws an exception, but with a completely different name/code. Safari 8.0.5 Takeaway. Unheap - A tidy repository of jQuery plugins. The evil closure explained. Everybody has fallen at least once into this pitfall: So what happened ?
Now imagine you are a CPU. Mother nature is generous: You have a virtually limitless ability to remember things.Your focus is total.You feel no remorse, no pain, no pity…Your mind soars at lightning speed.You can be 100% focused on up to 8 different things at the same time! Wouldn’t that be cool? But unfortunately everything has a price and you don’t have a will of your own. Maybe not so cool actually… But cheer up; we have a pretty bookshelf here: Now get to work! That’s the problem of the evil closure inside the loop! To be continued… Follow me! Typeahead.js. Club des développeurs JavaScript : actualités, cours, tutoriels, programmation, codes sources, livres, outils et forums. jQuery: The Write Less, Do More, JavaScript Library. jQuery – InView : déclencher des actions en fonction des éléments visibles à l’écran. - Ressources & Outils. Le plugin jQuery InView permet de déclencher des actions en JavaScript en fonction de l’apparition à l’écran d’un élément ou d’une partie de cet élément.
Il est donc facile d’imaginer toutes sortes de succession d’animations ou d’actions asynchrones grâce à ce plugin. Voyons comment l’utiliser. Où le trouver Cela se passe sur GitHub, il est donc possible de télécharger le script, mais également de l’améliorer et partager vos suggestions. Télécharger InView Comment l’utiliser ? Commencez simplement par appeler votre bibliothèque jQuery, puis chargez le plugin InView : Une fois le plugin chargé, il est possible de « binder », autrement dit de lier un élément à l’évènement « inview » pour effectuer des actions. $('.element').bind('inview',function(event, isInView, visiblePartX, visiblePartY){ // le code ici (ça va venir) }); La fonction accepte plusieurs variables qui vont nous permettre d’exécuter les choses au bon moment.
Nous allons concevoir une bête démonstration pour comprendre les bases. 1500+ Best jQuery Plugins & Tutorials with jQuery Demo examples. (1%) Piecon / Pie charts in your favicon!