Chainable interface in JavaScript

Creating Chainable interfaces in javascript…


(function() {
	function _init() {
		return this;
	}
	
	_init.prototype = {
		"myFunction": function() {
			return this;
		}
		
		// Put all the functions here - make sure all 'return this;'
	}
	
	chainer = function() {
		return new _init();
	}
})();

Roll out your own JavaScript Interfaces

[tags][/tags]

Author: Binny V A
A philosopher programmer who specializes in backend development and stoicism.

Leave a Reply

Your email address will not be published. Required fields are marked *