JSFiddle - React, Tailwind, and code Playground

JavaScript

//    Create the 'mega-img' proto
var proto = Object.create(HTMLImageElement.prototype);
proto.ready = function() {

    var deferred = Promise.defer();
    
	this.addEventListener('load', function(){
	    deferred.resolve(this);
	}, true);
				
	return deferred.promise;
};

var MegaImg = document.registerElement('mega-img', {
  prototype: proto,
  extends: 'img'
});


//    Append the image the the DOM
var xImg = document.createElement('img', 'mega-img');
document.body.appendChild(xImg);
xImg.setAttribute('src', 'http://blogs-images.forbes.com/merrillbarr/files/2014/02/the-walking-dead-.jpg')


//    Ussage:
xImg.ready().then(function(img) {
  // img loaded
    console.log('img is ready:', 'width: ' + img.width, 'height: ' + img.height)
}, function() {
  // something failed
});