JSFiddle - React, Tailwind, and code Playground

HTML

<a class="btn-print" href="#">Печать</a>
<a class="btn-print" href="#">Печать</a>

JavaScript

(function(self) { 
 
	var _ = function(el) { 
		if (this instanceof _) { 
			if (typeof el == 'string') {
				
				this.el = document.querySelectorAll(el);
			} else {
				
				this.el = el;
			}
			return this; 
		} else { 
			return new _(el); 
		}
	}
	
	 
	_.each = function(el, func) { 

		var i, len;
		if (el.length) { 
			for (i = 0, len = el.length; i < len; i++) {
				func.call(el[i]);
			}	
		} else { 
			func.call(el);
		}
	 
	}
	
	_.prototype.each = function(func) { 
		_.each(this.el, func);
		return this; 
	}

	_.prototype.bind = function(type, func) { 
		type = 'on' + type;

		this.each(function() { 
			var old = this[type];
			this[type] = function(e) {
				func.call(this, e);
				if (old && old.call) {
					old.call(this, e);
				}
			};
		});
	 
		return this; 
	}

	_.each(['click', 'load'], function() { 
		var type = this;
		_.prototype[type] = function(func) {
			this.bind(type, func);
		}
	});
	 
	self._ = _; 
	 
})(window); 


_(window).load(function() { 
	_('.btn-print').click(function() { 
		window.print(); 
	});
});