<commit_before>var glimpse = require('glimpse'),
    requestRepository = require('../repository/request-repository.js'),
    // TODO: Not sure I need to store the requests
    _requests = {},
    _requestSelectedId = null;

function requestsChanged(targetRequests) {
    glimpse.emit('shell.request.summary.changed', targetRequests);
}

// Clear Request
(function() {
    function clearRequest() {
        _requestSelectedId = null;

        glimpse.emit('shell.request.detail.changed', null);
    }

    glimpse.on('shell.request.detail.closed', clearRequest);
})();

// Found Data
(function() {
    function dataFound(payload) {
        // TODO: Really bad hack to get things going atm
        _requests[payload.newRequest.id] = payload.newRequest;

        if (payload.newRequest.id === _requestSelectedId) {
            glimpse.emit('shell.request.detail.changed', payload.newRequest);
        }
    }

    // External data coming in
    glimpse.on('data.request.detail.found', dataFound);
})();

// Trigger Requests
(function() {
    function triggerRequest(payload) {
        _requestSelectedId = payload.requestId;

        if (!FAKE_SERVER) {
            requestRepository.triggerGetDetailsFor(payload.requestId);
        }
    }

    glimpse.on('data.request.detail.requested', triggerRequest);
})();
<commit_msg>Switch over detail store to call central requestChange event<commit_after>var glimpse = require('glimpse'),
    requestRepository = require('../repository/request-repository.js'),
    // TODO: Not sure I need to store the requests
    _requests = {},
    _requestSelectedId = null;

function requestChanged(targetRequests) {
    glimpse.emit('shell.request.detail.changed', targetRequests);
}

// Clear Request
(function() {
    function clearRequest() {
        _requestSelectedId = null;

        requestChanged(null);
    }

    glimpse.on('shell.request.detail.closed', clearRequest);
})();

// Found Data
(function() {
    function dataFound(payload) {
        // TODO: Really bad hack to get things going atm
        _requests[payload.newRequest.id] = payload.newRequest;

        if (payload.newRequest.id === _requestSelectedId) {
            requestChanged(payload.newRequest);
        }
    }

    // External data coming in
    glimpse.on('data.request.detail.found', dataFound);
})();

// Trigger Requests
(function() {
    function triggerRequest(payload) {
        _requestSelectedId = payload.requestId;

        if (!FAKE_SERVER) {
            requestRepository.triggerGetDetailsFor(payload.requestId);
        }
    }

    glimpse.on('data.request.detail.requested', triggerRequest);
})();

{'fraction_non_alphanumeric': 0.12856599467478128, 'fraction_numerical': 0.0, 'mean_word_length': 3.1029641185647425, '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': '7475996', 'n_tokens_mistral': 724, 'n_tokens_neox': 749, 'n_words': 148}