Skip to content

Instantly share code, notes, and snippets.

View diego-betto's full-sized avatar

Diego Betto diego-betto

View GitHub Profile
@diego-betto
diego-betto / DOM-Ready.js
Created September 7, 2017 16:53 — forked from franzese/DOM-Ready.js
Vanilla JavaScript Document Ready
Document.prototype.ready = function(callback) {
if(callback && typeof callback === 'function') {
document.addEventListener("DOMContentLoaded", function() {
if(document.readyState === "interactive" || document.readyState === "complete") {
return callback();
}
});
}
};