JSFiddle - React, Tailwind, and code Playground

by chafferm

JavaScript

function context() {
    this.personHeader = {

        PreLoadInactiveHeaderImage: function (imageSourceArray) {
            if (imageSourceArray === undefined || imageSourceArray === null || imageSourceArray.length === undefined || Object.prototype.toString.call(imageSourceArray).slice(8, -1).toLowerCase() !== "array") {
                return;
            }

            var images = [];
            for (i = 0; i < imageSourceArray.length; i++) {
                images[i] = new Image();
                images[i].src = imageSourceArray[i];
            }

            images = null;
        }
    };

    return this;
}

$(document).data('global', context());

$(document).ready(function () {
    $(document).data('global').personHeader.PreLoadInactiveHeaderImage(["1.png", "2.png", "3.png"]);

});