<commit_before>'use strict';

var ActorAppDispatcher = require('../dispatcher/ActorAppDispatcher');
var ActorAppConstants = require('../constants/ActorAppConstants');
var ActorClient = require('../utils/ActorClient');
var ActionTypes = ActorAppConstants.ActionTypes;
var ActivityTypes = ActorAppConstants.ActivityTypes;

var EventEmitter = require('events').EventEmitter;
var assign = require('object-assign');

var CHANGE_EVENT = 'change';

var _activity = {
  type: 'default'
};

var ActivityStore = assign({}, EventEmitter.prototype, {
  getActivity: function() {
    return(_activity);
  },

  emitChange: function() {
    this.emit(CHANGE_EVENT);
  },

  addChangeListener: function(callback) {
    this.on(CHANGE_EVENT, callback)
  },

  removeChangeListener: function(callback) {
    this.removeListener(CHANGE_EVENT, callback)
  }
});

ActivityStore.dispatchToken = ActorAppDispatcher.register(function(action) {
  switch(action.type) {
    case ActionTypes.CLICK_USER:
      var user = ActorClient.getUser(action.userId);
      _activity = {
        type: ActivityTypes.USER_PROFILE,
        userId: action.userId,
        user: user
      };
      ActivityStore.emitChange();
      break;
    case ActionTypes.CLICK_GROUP:
      var group = ActorClient.getGroup(action.groupId);
      _activity = {
        type: ActivityTypes.GROUP_PROFILE,
        groupId: action.groupId,
        group: group
      };
      ActivityStore.emitChange();
      break;
    default:
  }
});

module.exports = ActivityStore;<commit_msg>feat(web): bind user in UserProfile<commit_after>'use strict';

var ActorAppDispatcher = require('../dispatcher/ActorAppDispatcher');
var ActorAppConstants = require('../constants/ActorAppConstants');
var ActorClient = require('../utils/ActorClient');
var ActionTypes = ActorAppConstants.ActionTypes;
var ActivityTypes = ActorAppConstants.ActivityTypes;

var EventEmitter = require('events').EventEmitter;
var assign = require('object-assign');

var CHANGE_EVENT = 'change';

var _activity = {
  type: 'default'
};

var ActivityStore = assign({}, EventEmitter.prototype, {
  getActivity: function() {
    return(_activity);
  },

  emitChange: function() {
    this.emit(CHANGE_EVENT);
  },

  addChangeListener: function(callback) {
    this.on(CHANGE_EVENT, callback)
  },

  removeChangeListener: function(callback) {
    this.removeListener(CHANGE_EVENT, callback)
  }
});

var _cleanup = function() {

};

ActivityStore.dispatchToken = ActorAppDispatcher.register(function(action) {
  switch(action.type) {
    case ActionTypes.CLICK_USER:
      _cleanup();

      var change = function(user) {
        _activity = {
          type: ActivityTypes.USER_PROFILE,
          userId: action.userId,
          user: user
        };

        ActivityStore.emitChange();
      };

      _cleanup = function() {
        ActorClient.unbindUser(action.userId, change);
      };

      ActorClient.bindUser(action.userId, change);

      break;
    case ActionTypes.CLICK_GROUP:
      var group = ActorClient.getGroup(action.groupId);
      _activity = {
        type: ActivityTypes.GROUP_PROFILE,
        groupId: action.groupId,
        group: group
      };
      ActivityStore.emitChange();
      break;
    default:
  }
});

module.exports = ActivityStore;
{'fraction_non_alphanumeric': 0.12069491008838769, 'fraction_numerical': 0.0, 'mean_word_length': 3.5331491712707184, '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': '6707236', 'n_tokens_mistral': 962, 'n_tokens_neox': 939, 'n_words': 177}