<commit_before>
INJECTOR = new Injector
        
class MainPresenter extends Presenter

    on_bind: () ->
        
        @register_handler("error", (event) ->
            INJECTOR.get_logger().log("ERROR: " + event.data, 5)
        , true)
        
        
        @register_handler("click", (event) -> 
            INJECTOR.get_event_bus().fire "display_message", "alert button clicked"
        , @display.get_alert_button())
    
class MainDisplay extends Display
    
    container = $('<div/>')
    
    constructor: () ->    
        @button = $('<input/>', {type: 'submit'})   
        @button.appendTo(container)
        
    get_alert_button: -> @button[0]
        
    as_widget: -> container

class MessageCentre extends Presenter

    on_bind: () ->
        @register_handler("display_message", (event) =>
            console.log("displaying message?")
            @display.show_message(event.data)
        , true)

class MessageCentreDisplay extends Display
    
    container = $('<div/>')
    
    constructor: () ->
        @num_messages = 0
        @message_holder = $('<h1/>')
        @message_holder.appendTo(container)
        
    show_message: (message) ->
        @message_holder.animate opacity: '0.5'
        
        @message_holder.text message + @num_messages
        
        @num_messages += 1
        
        @message_holder.animate opacity: '1.0'
        
    as_widget: -> container

class Application

    event_bus = new EventBus()
    logger = new Logger()
    
    run: ->
        INJECTOR.register("get_event_bus", -> return event_bus)
        INJECTOR.register("get_logger", -> return logger)
        INJECTOR.register("get_root_panel", -> return $("#application"))
        
        main_presenter = new MainPresenter(new MainDisplay())
        main_presenter.bind()
        
        message_presenter = new MessageCentre(new MessageCentreDisplay())
        message_presenter.bind()
        
        event_bus.fire('display_message', "Globally Listening ... ");
        
        INJECTOR.get_root_panel().append(main_presenter.get_display().as_widget())
        INJECTOR.get_root_panel().append(message_presenter.get_display().as_widget())

$(document).ready ->
    
    app = new Application()

    if window
        window.APP = app
    app.run()
    <commit_msg>tabs are spaces, spaces are tabs. what?<commit_after>
INJECTOR = new Injector

class MainPresenter extends Presenter

    on_bind: () ->

        @register_handler("error", (event) ->
            INJECTOR.get_logger().log("ERROR: " + event.data, 5)
        , true)


        @register_handler("click", (event) ->
            INJECTOR.get_event_bus().fire "display_message", "alert button clicked"
        , @display.get_alert_button())

class MainDisplay extends Display

    container = $('<div/>')

    constructor: () ->
        @button = $('<input/>', {type: 'submit'})
        @button.appendTo(container)

    get_alert_button: -> @button[0]

    as_widget: -> container

class MessageCentre extends Presenter

    on_bind: () ->
        @register_handler("display_message", (event) =>
            console.log("displaying message?")
            @display.show_message(event.data)
        , true)

class MessageCentreDisplay extends Display

    container = $('<div/>')

    constructor: () ->
        @num_messages = 0
        @message_holder = $('<h1/>')
        @message_holder.appendTo(container)

    show_message: (message) ->
        @message_holder.animate opacity: '0.5'

        @message_holder.text message + @num_messages

        @num_messages += 1

        @message_holder.animate opacity: '1.0'

    as_widget: -> container

class Application

    event_bus = new EventBus()
    logger = new Logger()

    run: ->
        INJECTOR.register("get_event_bus", -> return event_bus)
        INJECTOR.register("get_logger", -> return logger)
        INJECTOR.register("get_root_panel", -> return $("#application"))

        main_presenter = new MainPresenter(new MainDisplay())
        main_presenter.bind()

        message_presenter = new MessageCentre(new MessageCentreDisplay())
        message_presenter.bind()

        event_bus.fire('display_message', "Globally Listening ... ");

        INJECTOR.get_root_panel().append(main_presenter.get_display().as_widget())
        INJECTOR.get_root_panel().append(message_presenter.get_display().as_widget())

$(document).ready ->

    app = new Application()

    if window
        window.APP = app
    app.run()
{'fraction_non_alphanumeric': 0.12921222941307745, 'fraction_numerical': 0.004016960499888418, 'mean_word_length': 2.4556669236700075, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 43, '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': '6018452', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1293, 'n_words': 244}