JSFiddle - React, Tailwind, and code Playground
JavaScript
var $ = {}; // some global
var Master =
{
property: 'Property',
Func: function()
{
console.log('I am Func inside Master');
},
PassToGlobal: function()
{
$.master = this;
}
};
Master.PassToGlobal();
var Slave =
{
Master: $.master,
ShowFunc: function()
{
console.log(JSON.stringify(this.Master.Func));
this.Master.Func();
}
}
Slave.ShowFunc();