HEX
Server: Apache
System: Linux webd004.cluster130.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: frenchy (106757)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/f/r/e/frenchy/www/french-american.org/current/node_modules/uglyfly-js/demo/uglyfly.js
(function (define, console) {
    'use strict';
    define('uglyfly', ['get_uglyfly_api', 'sourceMap', 'bluebird'], function (get_uglyfly_api, sourceMap, Promise) {
        var noop = function () {
                return;
            },
            callbackRegistry = {
                warn: [],
                croak: [],
                getFileContents: function getFileContents(readpath, cb) {
                    //Instead of throwing an error you could do something clever like asking the user to submit the content
                    //  or retrieving the content with an AJAX call to a server you have set up.
                    var ex = {
                        name: 'Content Retrieval Error',
                        message: 'Cannot retrieve the contents for path: "' + readpath + '"'
                    };
                    cb(ex);
                }
            },
            logFn = (console && typeof console.log === 'function' && console.log) || noop,
            uglyflyDependencyHooks = {
                Promise: Promise,
                MOZ_SourceMap: sourceMap,
                getFileContentsPromise: Promise.promisify(function getFileContents(readpath, cb) {
                    var timeOutMilliseconds = 4000,
                        done = false;
                    function callback() {
                        if (!done) {
                            done = true;
                            cb.apply(this, arguments);
                        }
                    }
                    setTimeout(function () {
                        var ex;
                        if (done) {
                            return;
                        }
                        done = true;
                        ex = {
                            name: 'Content Retrieval Timeout Error',
                            message: 'Failed to retrieve the contents for path "' + readpath + '" within ' + (timeOutMilliseconds / 1000) + ' seconds.'
                        };
                        cb(ex);
                    }, timeOutMilliseconds);
                    callbackRegistry.getFileContents(readpath, callback);
                }),
                warn_callback: function warn_callback(text) {
                    /*jslint plusplus:true */
                    var i;
                    for (i = 0; i < callbackRegistry.warn.length; i++) {
                        callbackRegistry.warn[i](text);
                    }
                },
                croak_callback: function croak_callback(text) {
                    /*jslint plusplus:true */
                    var i;
                    for (i = 0; i < callbackRegistry.croak.length; i++) {
                        callbackRegistry.croak[i](text);
                    }
                }
            },
            uglyfly = get_uglyfly_api(uglyflyDependencyHooks);
        uglyfly.register_callback = function (callback_type, callback) {
            if (typeof callback !== 'function') {
                throw new TypeError('callback must be a function');
            }
            if (typeof callback_type !== 'string') {
                throw new TypeError('callback_type must be a string');
            }
            if (callbackRegistry[callback_type] === 'function') {
                callbackRegistry[callback_type] = callback;
            } else if (Object.prototype.toString.call(callbackRegistry[callback_type]) === '[object Array]') {
                callbackRegistry[callback_type].push(callback);
            } else {
                throw new Error('callback_type of "' + callback_type + '" is unrecognized');
            }
        };
        uglyfly.register_callback('warn', function (txt) {
            logFn('WARN: ' + txt);
        });
        uglyfly.register_callback('croak', function (txt) {
            logFn('ERR: ' + txt);
        });
        return uglyfly;
    });
}(window.define, window.console));