<commit_before>define(["jquery","underscore","backbone","models/account"],

    function($,_,Backbone,Account){

        var animationFrequency = 500;

        var IDELoader = function(){
            if (Account.isWebsocketEnabled()) {
                this.direction = "next";
                setInterval(_.bind(this.onFrameUpdate,this),animationFrequency);
                Account.waitForTenant(
                    _.bind(this.onTenantReady,this),
                    _.bind(this.onTenantError,this)
                );
            }
        };

        _.extend(IDELoader.prototype, Backbone.Events, {

            onTenantReady : function(d){
                    this.trigger("ready",d);
            },

            onTenantError : function(errors){
                if(errors.length !== 0){
                    this.trigger(
                        "error",
                        errors[0].getErrorDescription()
                    );
                }
            },

            onFrameUpdate : function(){
                var currentFrame = this.getCurrentFrame();
                this.getNextFrame().addClass("visible");
                currentFrame.removeClass("visible");
            },

            getNextFrame : function(){
                var currentFrame = this.getCurrentFrame();

                if(this.direction === "next"){
                    if(currentFrame.next(".loader").length !== 0){
                        return currentFrame.next(".loader");
                    }else{
                        this.direction = "prev";
                        return currentFrame.prev(".loader");
                    }
                }else{
                    if(currentFrame.prev(".loader").length !== 0){
                        return currentFrame.prev(".loader");
                    }else{
                        this.direction = "next";
                        return currentFrame.next(".loader");
                    }
                }
            },

            getCurrentFrame : function(){
                return $(".loader.visible");
            }
        });

        return {

            get : function(){
                return new IDELoader();
            },

            setLoaderMessage : function() {
                if (Account.getQueryParameterByName("type")==="factory"){
                    $(".loader-text").html("Creating your environment");
                }
            },

            IDELoader : IDELoader

        };

    }
);<commit_msg>CLDIDE-912 changed loader behavior<commit_after>define(["jquery","underscore","backbone","models/account"],

    function($,_,Backbone,Account){

        var animationFrequency = 500;

        var IDELoader = function(){
            if (Account.isWebsocketEnabled()) {
                this.direction = "next";
                setInterval(_.bind(this.onFrameUpdate,this),animationFrequency);
                Account.waitForTenant(
                    _.bind(this.onTenantReady,this),
                    _.bind(this.onTenantError,this)
                );
            }


        };

        _.extend(IDELoader.prototype, Backbone.Events, {

            onTenantReady : function(d){
                    this.trigger("ready",d);
            },

            onTenantError : function(errors){
                if(errors.length !== 0){
                    this.trigger(
                        "error",
                        errors[0].getErrorDescription()
                    );
                }
            },

            onFrameUpdate : function(){
                var currentFrame = this.getCurrentFrame();
                this.getNextFrame().addClass("visible");
                currentFrame.removeClass("visible");
            },

            getNextFrame : function(){
                var currentFrame = this.getCurrentFrame();

                if(this.direction === "next"){
                    if(currentFrame.next(".loader").length !== 0){
                        return currentFrame.next(".loader");
                    }else{
                        this.direction = "prev";
                        return currentFrame.prev(".loader");
                    }
                }else{
                    if(currentFrame.prev(".loader").length !== 0){
                        return currentFrame.prev(".loader");
                    }else{
                        this.direction = "next";
                        return currentFrame.next(".loader");
                    }
                }
            },

            getCurrentFrame : function(){
                return $(".loader.visible");
            }
        });

        _.extend(IDELoader.prototype, Backbone.View, {
          setLoaderMessage : function() {
                if (Account.getQueryParameterByName("type")==="factory" || Account.getQueryParameterByName("type")==="create"){
                    $(".loader-text").html("Creating your environment");
                }
            }
        });

        return {

            get : function(){
                return new IDELoader();
            },

            IDELoader : IDELoader

        };

    }
);
{'fraction_non_alphanumeric': 0.12165069430862507, 'fraction_numerical': 0.0033248582045765696, 'mean_word_length': 1.1845365228534814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7532475', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1099, 'n_words': 166}