JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#" id="opener">open popup simulation</a>

JavaScript

var popup = {
    count: 0,
    firstUse: function() {
        alert("running this function");
    },
    open: function() {
        this.count++;
        if (typeof(this.firstUse) == "function") {
            this.firstUse();
            this.firstUse = null; // destroy method
        }
        alert("this is our " + this.count + " run");
    }
};

document.getElementById("opener").onclick = function() {
    popup.open();
    return false;
};