<commit_before>var abp = abp || {};
(function () {

    // Check if SignalR is defined
    if (!signalR) {
        return;
    }

    // Create namespaces
    abp.signalr = abp.signalr || {};
    abp.signalr.hubs = abp.signalr.hubs || {};
    abp.signalr.reconnectTime = abp.signalr.reconnectTime || 5000;
    abp.signalr.maxTries = abp.signalr.maxTries || 8;
    abp.signalr.increaseReconnectTime = abp.signalr.increaseReconnectTime || function (time) {
        return time * 2;
    };

    // Configure the connection for abp.signalr.hubs.common
    function configureConnection(connection) {
        // Set the common hub
        abp.signalr.hubs.common = connection;

        let tries = 1;
        let reconnectTime = abp.signalr.reconnectTime;

        // Reconnect loop
        function tryReconnect() {
            if (tries <= abp.signalr.maxTries) {
                connection.start()
                    .then(function () {
                        reconnectTime = abp.signalr.reconnectTime;
                        tries = 1;
                        console.log('Reconnected to SignalR server!');
                    }).catch(function () {
                    tries += 1;
                    reconnectTime = abp.signalr.increaseReconnectTime(reconnectTime);
                    setTimeout(function () {
                            tryReconnect()
                        },
                        reconnectTime
                    );
                });
            }
        }

        // Reconnect if hub disconnects
        connection.onclose(function (e) {
            if (e) {
                abp.log.debug('Connection closed with error: ' + e);
            } else {
                abp.log.debug('Disconnected');
            }

            if (!abp.signalr.autoReconnect) {
                return;
            }

            tryReconnect();
        });

        // Register to get notifications
        connection.on('getNotification', function (notification) {
            abp.event.trigger('abp.notifications.received', notification);
        });
    }

    // Connect to the server for abp.signalr.hubs.common
    function connect() {<commit_msg>adds ondisconnected and reconnected events to signalr<commit_after>var abp = abp || {};
(function () {

    // Check if SignalR is defined
    if (!signalR) {
        return;
    }

    // Create namespaces
    abp.signalr = abp.signalr || {};
    abp.signalr.hubs = abp.signalr.hubs || {};
    abp.signalr.reconnectTime = abp.signalr.reconnectTime || 5000;
    abp.signalr.maxTries = abp.signalr.maxTries || 8;
    abp.signalr.increaseReconnectTime = abp.signalr.increaseReconnectTime || function (time) {
        return time * 2;
    };

    // Configure the connection for abp.signalr.hubs.common
    function configureConnection(connection) {
        // Set the common hub
        abp.signalr.hubs.common = connection;

        let tries = 1;
        let reconnectTime = abp.signalr.reconnectTime;

        // Reconnect loop
        function tryReconnect() {
            if (tries <= abp.signalr.maxTries) {
                connection.start()
                    .then(function () {
                        reconnectTime = abp.signalr.reconnectTime;
                        tries = 1;
                        console.log('Reconnected to SignalR server!');
                        abp.event.trigger('abp.signalr.reconnected');
                    }).catch(function () {
                    tries += 1;
                    reconnectTime = abp.signalr.increaseReconnectTime(reconnectTime);
                    setTimeout(function () {
                            tryReconnect()
                        },
                        reconnectTime
                    );
                });
            }
        }

        // Reconnect if hub disconnects
        connection.onclose(function (e) {
            if (e) {
                abp.log.debug('Connection closed with error: ' + e);
            } else {
                abp.log.debug('Disconnected');
            }

            if (!abp.signalr.autoReconnect) {
                return;
            }
            
            abp.event.trigger('abp.signalr.disconnected');
            tryReconnect();
        });

        // Register to get notifications
        connection.on('getNotification', function (notification) {
            abp.event.trigger('abp.notifications.received', notification);
        });
    }

    // Connect to the server for abp.signalr.hubs.common
    function connect() {
{'fraction_non_alphanumeric': 0.10635940615998227, 'fraction_numerical': 0.0039884777309993355, 'mean_word_length': 1.4492674986435161, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5452917', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1191, 'n_words': 230}