<commit_before>define(function (require)
{   "use strict";

    var React       = require( "react" )
      , PouchDB     = require( "pouchdb" )
      , Router      = require( "director" )
      , Config      = require( "./controller/Config")
      , MainView    = require( "./view/Main" )
      ;

    function Application()
    {
        this.config = new Config();
        var db = this.db = new PouchDB( "collector" );
        db.changes({ live: true, since: "now" }).on( "change", this.onChange.bind( this ) );
        this.router = new Router({
            "home": this.onHome.bind( this )
          , "config": this.onConfig.bind( this )
        });
    }

    Application.prototype.init = function()
    {
        this._main_view = React.render(
            React.createElement( MainView, { config: this.config }, null )
          , document.body
        );
        this.router.init();
        this.onChange();
    };

    Application.prototype.getMainView = function()
    {
        return this._main_view;
    };

    Application.prototype.setPath = function( path )
    {
        this.getMainView().setState({ path: path });
    };

    Application.prototype.setConfig = function( config )
    {
        this.getMainView().setState({ config: config });
    };

    Application.prototype.setItems = function( items )
    {
        this.getMainView().setState({ items: items });
    };

    Application.prototype.onHome = function()
    {
        this.setPath( "home" );
    };

    Application.prototype.onConfig = function()
    {
        this.setPath( "config" );
    };

    Application.prototype.onChange = function()
    {
        this.db.query( "added", { include_docs: true })
            .then( function( result ) {
                return result.rows.map( function( row ) {
                    return row.doc;
                });
            })
            .then( this.setItems.bind( this ) )
        ;
    };

    return Application;
});<commit_msg>added console info for incoming updates<commit_after>define(function (require)
{   "use strict";

    var React       = require( "react" )
      , PouchDB     = require( "pouchdb" )
      , Router      = require( "director" )
      , Config      = require( "./controller/Config")
      , MainView    = require( "./view/Main" )
      ;

    function Application()
    {
        this.config = new Config();
        var db = this.db = new PouchDB( "collector" );
        db.changes({ live: true, since: "now" }).on( "change", this.onChange.bind( this ) );
        this.router = new Router({
            "home": this.onHome.bind( this )
          , "config": this.onConfig.bind( this )
        });
    }

    Application.prototype.init = function()
    {
        this._main_view = React.render(
            React.createElement( MainView, { config: this.config }, null )
          , document.body
        );
        this.router.init();
        this.onChange();
    };

    Application.prototype.getMainView = function()
    {
        return this._main_view;
    };

    Application.prototype.setPath = function( path )
    {
        this.getMainView().setState({ path: path });
    };

    Application.prototype.setConfig = function( config )
    {
        this.getMainView().setState({ config: config });
    };

    Application.prototype.setItems = function( items )
    {
        this.getMainView().setState({ items: items });
    };

    Application.prototype.onHome = function()
    {
        this.setPath( "home" );
    };

    Application.prototype.onConfig = function()
    {
        this.setPath( "config" );
    };

    Application.prototype.onChange = function( change )
    {
        console.info( "change", change );
        this.db.query( "added", { include_docs: true, attachments: false })
            .then( function( result ) {
                return result.rows.map( function( row ) {
                    return row.doc;
                });
            })
            .then( this.setItems.bind( this ) )
        ;
    };

    return Application;
});
{'fraction_non_alphanumeric': 0.1411910669975186, 'fraction_numerical': 0.0, 'mean_word_length': 1.844742413549753, 'pattern_counts': {'":': 4, '<': 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': '6932620', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1138, 'n_words': 233}