🎨 Flat, simple, multi-themed, responsive and hackable Color-Picker library. No dependencies, no jQuery. Compatible with all CSS Frameworks e.g. Bootstrap, Materialize. Supports alpha channel, rgba, hsla, hsva and more!
I'm now using this library to create a CAD app using Electron. I really appreciate this library due to its easiness to be config'ed. But since my app uses more requestAnimationFrame, FPS kind of become important here.
I found that the constructor is coded using requestAnimationFrame, maybe this is due to get the Pickr offsetWidth. But, if somehow the element was not rendered by the javascript EventLoop and Picker element is destroyAndRemove() for some reason, the constructor will get stuck in an infinite loop of a requestAnimationFrame.
Here is how to reproduce. Open devtools console, then type:
var el = document.createElement('div')
document.body.append(el)
var a = Pickr.create({useAsButton:true, el});
a.destroyAndRemove();
and record the performance profile from chrome dev-tools. You will see a lot of useless 100us requestAnimationFrame call tree.
My solution, give the flag _destroyed and set it to true when destroy() called.
I'm now using this library to create a CAD app using Electron. I really appreciate this library due to its easiness to be config'ed. But since my app uses more requestAnimationFrame, FPS kind of become important here.
I found that the constructor is coded using
requestAnimationFrame
, maybe this is due to get the Pickr offsetWidth. But, if somehow the element was not rendered by the javascript EventLoop and Picker element isdestroyAndRemove()
for some reason, the constructor will get stuck in an infinite loop of arequestAnimationFrame
.Here is how to reproduce. Open devtools console, then type:
and record the performance profile from chrome dev-tools. You will see a lot of useless 100us
requestAnimationFrame
call tree.My solution, give the flag
_destroyed
and set it to true whendestroy()
called.