module ImprovedInitiative {
    export class EventLog {
        Events = ko.observableArray<string>();
        
        LatestEvent = ko.pureComputed(() => this.Events()[this.Events().length - 1] || "Welcome to Improved Initiative!");
        EventsTail = ko.pureComputed(() => this.Events().slice(0, this.Events().length - 1));
        
        AddEvent = (event: string) => {
            this.Events.push(event);
            this.scrollToBottomOfLog();
        }

        ToggleFullLog = () => {
            if(this.ShowFullLog()) {
                this.ShowFullLog(false);
                $('.combatants').css('flex-shrink', 1);
            } else {
                this.ShowFullLog(true);
                $('.combatants').css('flex-shrink', 0);
                this.scrollToBottomOfLog();
            }
        }

        ShowFullLog = ko.observable<boolean>(false);

        private element = $('.event-log');
        
        private scrollToBottomOfLog = () => {
            let scrollHeight = this.element[0].scrollHeight;
            this.element.scrollTop(scrollHeight);
        }
    }
}
module ImprovedInitiative {
    export class EventLog {
        Events = ko.observableArray<string>();
        
        LatestEvent = ko.pureComputed(() => this.Events()[this.Events().length - 1] || "Welcome to Improved Initiative!");
        EventsTail = ko.pureComputed(() => this.Events().slice(0, this.Events().length - 1));
        
        AddEvent = (event: string) => {
            this.Events.push(event);
        }

        ToggleFullLog = () => {
            if(this.ShowFullLog()) {
                this.ShowFullLog(false);
                $('.combatants').css('flex-shrink', 1);
            } else {
                this.ShowFullLog(true);
                $('.combatants').css('flex-shrink', 0);
                this.scrollToBottomOfLog();
            }
        }

        ShowFullLog = ko.observable<boolean>(false);

        private element = $('.event-log');
        
        private scrollToBottomOfLog = () => {
            let scrollHeight = this.element[0].scrollHeight;
            this.element.scrollTop(scrollHeight);
        }
    }
}
Remove scroll after every event for perf
Remove scroll after every event for perf
