JSFiddle - React, Tailwind, and code Playground

JavaScript

// First 3 parameters are part of the API
// Last 5 parameters are used as local variables and will be overwritten
module.exports = function(fontName, onReady, options, startupIframe, shutdown, root, onTimeout, areEqual) {

    var test

    if ('test' == process.env.NODE_ENV)
    {
        // A helper function that counts the creation and destruction of
        //   elements and event listeners for testing purposes
        test = window.onfontreadyTestReporter = window.onfontreadyTestReporter || function(t) {

            t = {}

            return {
                increment: function(name, type) {
                    if (!t[name])
                    {
                        t[name] = {
                            root: 0,
                            load: 0,
                            resize: 0
                        }
                    }
                    t[name][type] += 1
                },
                decrement: function(name, type) {
                    if (!t[name])
                    {
                        t[name] = {
                            root: 0,
                            load: 0,
                            resize: 0
                        }
                    }
                    t[name][type] -= 1
                },
                fullReport: function() {
                    return t
                }
            }
 
        }

    }

    // Passing outerShutdown allows shutdown sequence in reverse order
    //   without variables or loops
    startupIframe = function(iframe, outerShutdown) {
        // The iframe is already positioned off the top-left of the page
        //   Thus, the positive right and bottom offsets do not matter
        // Most of the string is shared with the div styles below
        iframe.style.cssText = 'position:absolute;right:999%;bottom:999%;width:100%'

        iframe.onload = function() {
            // Prevent onload startup if shutdown already called
            if (!root) return
        ...