JSFiddle - React, Tailwind, and code Playground

JavaScript

function App() {
    this.onStart = $.Callbacks();
    this.onStop  = $.Callbacks();
    this.start   = this.onStart.fire;
    this.finish  = this.onStop.fire;
};

app1 = new App();
app2 = new App();

app1.onStart.add(function() { alert(1) });
app2.onStart.add(function() { alert(2) });

app1.start();
app2.start();