JSFiddle - React, Tailwind, and code Playground

JavaScript

new Bla().start();

function Bla(){
    this.start = function(){
        alert("starting");
        x(this.done,this);
    }

    this.done = function(){
        alert("done");
        try{
            this.postDone();
        }
        catch(e){
            alert(e);
        }
    }

    this.postDone = function(){
        alert("postdone");
    }
}

function x(callback,object){
    alert("x");
    try{
        callback.apply(object);
    }
    catch(e){
        alert(e);
    }
}