Skip to content

Tag: javascript

html2canvas not capturing image

html2canvas.js not capturing image. it leaves white space where the image occurs. I have tried a lot but i cannot find solution . Help is appreciated 🙂 Answer It works, when I host it in the server. The security restrictions causes it to fail.

How to check if an object is a Promise?

Whether it’s an ES6 Promise or a Bluebird Promise, Q Promise, etc. How do I test to see if a given object is a Promise? Answer How a promise library decides If it has a .then function – that’s the only standard promise libraries use. The Promises/A+ specification has a notion called thenable…

How do i find and count unique values in nested JSON objects?

i have the following JavaScript What i am trying to accomplish is when the order comes through a function scans the JSON and creates an array with each unique product name and adds 1 to the quantity each time. i have tried using a for loop but it loops it the amount of times but doesn’t find the name an…

Increase performance for 10,000 particles in HTML5 Canvas

I have two JS Fiddles, both with 10,000 snow flakes moving around but with two different approaches. The first fiddle: http://jsfiddle.net/6eypdhjp/ Uses fillRect with a 4 by 4 white square, providing roughly 60 frames per second @ 10,000 snow flakes. So I wondered if I could improve this and found a bit of i…