Q:

Page load status and calling it once. [ javascript]

So I made a function that displays page loading process in the console. 
    var processLoader = 1;
    var processesToLoadInTotal = 14;
    var progressBarFill = "";
    function processBar(msg) {
        // console.clear();
        var procent = Math.floor((processLoader / processesToLoadInTotal)*100);
        if (procent >= 100) {
            console.info("%cFully loaded.", " border-radius: 5px;background-color: green; color: white; font-size: 16px; padding: 3px;");
        } else {
            processLoader++;
            progressBarFill += " ";
            var progressBarEmpty = "";
            for (var i = 0; i < processesToLoadInTotal - processLoader; i++) {
                progressBarEmpty += " ";
            }
            console.info("%c"+progressBarFill+"%c"+progressBarEmpty, "border: 1px solid black;border-radius: 5px 0 0 5px;background-color: #6cf; color: white; font-size: 16px; padding: 3px;","border: 1px solid black;border-radius: 0 5px 5px 0;background-color: black; color: white; font-size: 16px; padding: 3px;");
            console.info(procent + "% "+ msg);
        }
    }
    processBar("Loaded page.") 

So my idea was to have a loading bar in the console and that works.  I call the function at 14 points across my project but my problem is that I have an event listener at one point for button press.  When I press the button the final processBar is called again.  So I have two problems:

Is there a way to collect automatically the processesToLoadTotal (how many times the function will execute or I must specify it manually? 
Can I call a function once on a given row?  Maybe an array of some sort? 

P.S.: I don't have any exp in javascript.  And I don't use jQuery for this project and I intend to keep it that way. 
Thank you

A:

I went with a different approach.  While I was adding time stamps in the console I made another if else where I do nothing. 
<script type="text/javascript">
    var dev = false;
    var processLoader = 1;
    var processesToLoadInTotal = 14;
    var y = 1;
    var names = [];
    for (var i = 0; i < processesToLoadInTotal; i++) {
        names[i] = "Точка "+y;
        y++;
    }
    var progressBarFill = "";
    function processBar(msg) {
        if (dev) {
            if (processLoader ! = 1) {
                console.timeEnd(names[processLoader-2]);
            }
            console.time(names[processLoader-1]);
        } else {
            console.clear();
        }
        var percent = Math.floor((processLoader / processesToLoadInTotal)*100);
        if (percent == 100) {
            console.info("%cFully loaded.", " border-radius: 5px;background-color: green; color: white; font-size: 16px; padding: 3px;");
            console.warn("%c Нещо не си взима правилно window.innerWidth.  core.js ред: 16.  Оказа се, че е само на firefox... core.js:15", "font-size: 16px");
            processLoader++;
        } else if (percent > 100) {

        } else {
            processLoader++;
            progressBarFill += " ";
            var progressBarEmpty = "";
            for (var i = 0; i < processesToLoadInTotal - processLoader; i++) {
                progressBarEmpty += " ";
            }
            console.info("%c"+progressBarFill+"%c"+progressBarEmpty, "border: 1px solid black;border-radius: 5px 0 0 5px;background-color: #6cf; color: white; font-size: 16px; padding: 3px;","border: 1px solid black;border-radius: 0 5px 5px 0;background-color: black; color: white; font-size: 16px; padding: 3px;");
            console.info(percent + "% "+ msg);
        }
    }
    processBar("Loading head includes.") 
    </script>

