Skip to content

Instantly share code, notes, and snippets.

View mistakster's full-sized avatar

Vladimir Kuznetsov mistakster

View GitHub Profile
@mistakster
mistakster / gist:4193053
Last active October 13, 2015 12:07
onAvailable: Executes the supplied callback when the item with the supplied id is found.
(function (window, document) {
function onLoad(callback) {
if (document.readyState === "complete") {
setTimeout(callback, 1);
} else if (document.addEventListener) {
window.addEventListener("load", callback, false);
} else {
window.attachEvent("onload", callback);
}