frontend - What is this JavaScript hack? -


i found code in javascript, , wondering if kind of hack, or mistake :

var img = new image(); img.src = myhttpsrc; img.onload = function () {     img.onload = null; }; 

the code seems load image myhttpsrc. there event handler onload triggered when loaded. handler removing once load completed.

this not hack, onload handler not doing other removing seems redundant.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -