Quick Tip – Long Polling Using jQuery

August 26, 2013

Quick Tip – Long Polling Using jQuery Yesterday, I helped to write infrastructure code for a JavaScript SDK API that one of my customers is building right now. One of the things that needed to be implemented as part of the SDK was the functionality of long polling. Since the SDK has a dependency on jQuery, here is the code snippet that we used as starting point to write the implementation: function longPoll(){ $.ajax({ ...
one comment

Quick Tip – Converting JavaScript Array-like Objects to Real Arrays

August 20, 2013

Quick Tip – Converting JavaScript Array-like Objects to Real Arrays JavaScript includes many array-like objects/collections like the arguments object and NodeList. Those objects aren’t real JavaScript arrays but they can be converted into real arrays very easily. The way to do that is using the Array.prototype.slice function. Using Array.prototype.slice to Convert Array-like Objects to Real Arrays The Array.prototype.slice function returns a shallow copy of a portion of an array. It receives two parameters:  starting index and end index which are used as start and end points in the slice. For example the following code will...
no comments