<commit_before>(function(){
    "use strict";

    var DomUtils = require("../utils/dom.js");

    recurve("rcLazyLoad").value("$lazyLoad", {
        js: function(url, onComplete, onError) {
            var element = DomUtils.createElement("link", {type: "text/css", rel: "stylesheet", href: url});
            load(element, onComplete, onError);
        },

        css: function(url, onComplete, onError) {
            var element = DomUtils.createElement("script", {type: "text/javascript", src: url});
            load(element, onComplete, onError);
        }
    });

    function load(element, onComplete, onError) {
        function loadedHandler() {
            cleanup();
            onComplete();
        }

        function errorHandler(event) {
            cleanup();
            onError(event);
        }

        function cleanup() {
            DomUtils.removeEventListener(element, "load", loadedHandler);
            DomUtils.removeEventListener(element, "error", errorHandler);
        }

        // Maintain execution order
        // http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
        // http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/
        element.async = false;
        element.defer = false;

        DomUtils.addEventListener(element, "load", loadedHandler);
        DomUtils.addEventListener(element, "error", errorHandler);

        document.head.appendChild(element);
    }
})();<commit_msg>fixed creation of lazy load add on module<commit_after>(function(){
    "use strict";

    var DomUtils = require("../utils/dom.js");

    var lazyLoadModule = recurve.createModule("rcLazyLoad");
    
    lazyLoadModule.value("$lazyLoad", {
        js: function(url, onComplete, onError) {
            var element = DomUtils.createElement("link", {type: "text/css", rel: "stylesheet", href: url});
            load(element, onComplete, onError);
        },

        css: function(url, onComplete, onError) {
            var element = DomUtils.createElement("script", {type: "text/javascript", src: url});
            load(element, onComplete, onError);
        }
    });

    function load(element, onComplete, onError) {
        function loadedHandler() {
            cleanup();
            onComplete();
        }

        function errorHandler(event) {
            cleanup();
            onError(event);
        }

        function cleanup() {
            DomUtils.removeEventListener(element, "load", loadedHandler);
            DomUtils.removeEventListener(element, "error", errorHandler);
        }

        // Maintain execution order
        // http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
        // http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/
        element.async = false;
        element.defer = false;

        DomUtils.addEventListener(element, "load", loadedHandler);
        DomUtils.addEventListener(element, "error", errorHandler);

        document.head.appendChild(element);
    }
})();
{'fraction_non_alphanumeric': 0.13486513486513488, 'fraction_numerical': 0.005328005328005328, 'mean_word_length': 2.367713004484305, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1429978', 'n_tokens_mistral': 824, 'n_tokens_neox': 792, 'n_words': 156}