JSFiddle - React, Tailwind, and code Playground

by podgorniy

JavaScript

window.QLJS = {
	closeBottomExpansionPanels : function (arg1, arg2) {
		console.log(arg1, arg2, 'initial');
	}
}

function decorate(initial, decorate_before, decorate_after) { 
	return function() { 
		var initial_call_result,   updated_params,   updated_result;
		if (typeof decorate_before === 'function') {  updated_params = decorate_before.apply(this, arguments);  
			if (!updated_params) {  
				return;  
			} 
		} initial_call_result = initial.apply(this, updated_params || arguments); 
		if (typeof decorate_after === 'function') {  updated_result = decorate_after.apply(this, arguments); 
		} 
		return updated_result === undefined ? initial_call_result : updated_result; 
	};
}

window.QLJS.closeBottomExpansionPanels = decorate(window.QLJS.closeBottomExpansionPanels, function(str) { 
	var args;

	// console.info(str); // only first

	 args = [str[0], 2]; 
	return args;
});

window.QLJS.closeBottomExpansionPanels('.selector .selector', 1);