In Color scheme explorer the main color processing scripts are hosted in Google Apps Script. There’s particular no reason to do this, except that it means that I can ensure I use the same algorithms in JavaScript as I do in GAS.
Building on Using Gas as a CDN, where I use the GAS publisher and content service to serve up JavaScript, here’s how it works in the  Color scheme explorer

Asynchronous loading

When it starts up, you may notice this
Here’s what’s happening then..

Called here, and moving on to load Data from once the load promise for each of the required apps script functions is fulfilled.

$('#status').text("...getting google apps script modules");
$.when.apply($,loadModules (["vEquivalents","hacks","usefulColors"],"mcpher")).then (
    function () {
        var randomColor = randomBar();
        // get the currently selected scheme, and if nothing entered yet, generate a random scheme
            .done( function() {
                if (!$('#hexinput').val()) calculateColors (rgbToHTMLHex(randomColor),"random color");
     function (error) {
Again, the use of promises simplifies and abstracts away the whole messy business of asynchronicity.