<commit_before>'use strict';

angular.module('oide.states', [])
.factory('StateService', ['$http', '$log', function($http,$log) {
  var storeState = function () {
    $http({
      url: '/a/state',
      method: 'POST',
      params: {
        _xsrf: getCookie('_xsrf'),
        state: JSON.stringify(state)
      }
    })
    .success(function (data, status, headers, config) {
      $log.debug('Stored state for user.');
    })
    .error(function (data, status, headers, config) {
      $log.error('Failed to store state for user.');
    });
  };
  var getState = function () {
    return $http
    .get('/a/state')
    .success(function (data, status, headers, config) {
      $log.debug('Retrieved state for user: ', data);
      return data;
    })
    .error(function (data, status, headers, config) {
      $log.error('Failed to retrieve state for user.');
    });
  };
  var state = getState();
  return {
    state: state,
    storeState: function () {
      storeState();
    },
    getState: function () {
      getState();
    }
  };
}]);<commit_msg>State can now be passed-by-reference properly.<commit_after>'use strict';

angular.module('oide.states', [])
.factory('StateService', ['$http', '$log', function($http,$log) {
  var state = {'state': {}};
  var storeState = function () {
    $http({
      url: '/a/state',
      method: 'POST',
      params: {
        _xsrf: getCookie('_xsrf'),
        state: JSON.stringify(state.state)
      }
    })
    .success(function (data, status, headers, config) {
      $log.debug('Stored state for user.');
    })
    .error(function (data, status, headers, config) {
      $log.error('Failed to store state for user.');
    });
  };
  var getState = function () {
    return $http
    .get('/a/state')
    .success(function (data, status, headers, config) {
      $log.debug('Retrieved state for user: ', data);
      return data;
    })
    .error(function (data, status, headers, config) {
      $log.error('Failed to retrieve state for user.');
    });
  };
  var initializeState = function () {
    return $http
    .get('/a/state')
    .success(function (data, status, headers, config) {
      $log.debug('Retrieved state for user: ', data);
      state.state = data;
    })
    .error(function (data, status, headers, config) {
      $log.error('Failed to retrieve state for user.');
    });
  };
  initializeState();
  return {
    state: state.state,
    storeState: function () {
      storeState();
    },
    getState: function () {
      getState();
    }
  };
}]);
{'fraction_non_alphanumeric': 0.1757981868348443, 'fraction_numerical': 0.0, 'mean_word_length': 2.6102418207681364, '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': '6014747', 'n_tokens_mistral': 791, 'n_tokens_neox': 794, 'n_words': 197}