JSFiddle - React, Tailwind, and code Playground

by lchau

JavaScript

var MyModule;

(function(module) {
    var other = {
        greet: function() {
            console.log('context switch');
        }
    };
    var beacon = {
        greet: function() {
            console.log('hello');
        },
        somethingElse: function() {
            console.log('beacon');
        },
        doSomething: function() {
            var greet = other.greet.bind(this);
            setTimeout(greet, 1000);
        }
    };
    module.method = beacon;
})(MyModule || (MyModule = {}));

MyModule.method.doSomething();