JSFiddle - React, Tailwind, and code Playground

JavaScript

"use strict";

function callself(instance, callback) { // saves 'this' state for reuse inside another function
	return function () {
		var argumentsList = [this], i;

		for (i = 0; i < arguments.length; i = i + 1) {
			argumentsList.push(arguments[i]);
		}

		return callback.apply(instance, argumentsList);
	};
}

var Namespace = function () {
	var settings = { handler: this.method };

	this.initialize = function () {
		$.fn.myPlugin = callself(this, function (that, userInput) {
            /* this = Namespace
               that = jQuery element
               userInput = provided in line 30 as parameter
            */
            console.log(this);
            console.log(that);
            console.log(userInput);
			console.log(settings.handler); // why why it's undefined?
		});

		$('body').myPlugin('someData');
	};

	this.method = function () { console.info('method'); }; // this method should be returned as reference in line 27, but it can not reah 'this` - don't know why
};
new Namespace().initialize();