{"action":"created","issue":{"url":"https://api.github.com/repos/desandro/imagesloaded/issues/122","labels_url":"https://api.github.com/repos/desandro/imagesloaded/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/desandro/imagesloaded/issues/122/comments","events_url":"https://api.github.com/repos/desandro/imagesloaded/issues/122/events","html_url":"https://github.com/desandro/imagesloaded/issues/122","id":26058913,"number":122,"title":"Synchronously test if image(s) is loaded?","user":{"login":"nybblr","id":794113,"avatar_url":"https://avatars.githubusercontent.com/u/794113?v=3","gravatar_id":"","url":"https://api.github.com/users/nybblr","html_url":"https://github.com/nybblr","followers_url":"https://api.github.com/users/nybblr/followers","following_url":"https://api.github.com/users/nybblr/following{/other_user}","gists_url":"https://api.github.com/users/nybblr/gists{/gist_id}","starred_url":"https://api.github.com/users/nybblr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nybblr/subscriptions","organizations_url":"https://api.github.com/users/nybblr/orgs","repos_url":"https://api.github.com/users/nybblr/repos","events_url":"https://api.github.com/users/nybblr/events{/privacy}","received_events_url":"https://api.github.com/users/nybblr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-01-22T01:06:24Z","updated_at":"2015-10-27T20:53:17Z","closed_at":"2015-10-27T20:53:17Z","body":"I am using this plugin to show a loading animation for images in a slideshow: before fading to the next slide, I use imagesLoaded.done() on the particular slide.\r\n\r\nBefore creating the callback, I first show the loader. The done() callback hides it.\r\n\r\nThis works great when the next image in the slideshow is downloading: the loader shows and hides itself appropriately. However, once the images are already loaded, the loader \"flickers\" between slides because it is being shown, then immediately hidden in the done() callback. Since the callback isn't executed synchronously, the DOM has a chance to rerender before hiding the loader.\r\n\r\nThe resulting effect is an irritating flicker between every single slide. So it'd be nice to take advantage of the LoadingImage.prototype.check method to check if an image is already loaded (or failed to load) without handing the thread back to the browser for a rerender. Then I could check if the image is loaded before even showing the loader (and thus prevent the flicker altogether).\r\n\r\nI know this can usually be done with `.complete` on the image node, but to my knowledge this has some compatibility issues; is this cross-browser logic already implemented in imagesLoaded? Could it be exposed for use?\r\n\r\nOr, maybe an option could be passed in which makes imagesLoaded trigger the callbacks immediately (without giving up the main thread) if the image is loaded?\r\n\r\n\r\n~ Jonathan"},"comment":{"url":"https://api.github.com/repos/desandro/imagesloaded/issues/comments/151640297","html_url":"https://github.com/desandro/imagesloaded/issues/122#issuecomment-151640297","issue_url":"https://api.github.com/repos/desandro/imagesloaded/issues/122","id":151640297,"user":{"login":"desandro","id":85566,"avatar_url":"https://avatars.githubusercontent.com/u/85566?v=3","gravatar_id":"","url":"https://api.github.com/users/desandro","html_url":"https://github.com/desandro","followers_url":"https://api.github.com/users/desandro/followers","following_url":"https://api.github.com/users/desandro/following{/other_user}","gists_url":"https://api.github.com/users/desandro/gists{/gist_id}","starred_url":"https://api.github.com/users/desandro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/desandro/subscriptions","organizations_url":"https://api.github.com/users/desandro/orgs","repos_url":"https://api.github.com/users/desandro/repos","events_url":"https://api.github.com/users/desandro/events{/privacy}","received_events_url":"https://api.github.com/users/desandro/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T20:53:17Z","updated_at":"2015-10-27T20:53:17Z","body":"Sorry, but I will not be able to resolve this issue."}}