<commit_before>import { Observable } from 'rxjs/Observable';

export class Messenger {
    constructor(public source: string) { }

    send(type: MessageType, message: any) {
        return window.top.postMessage({ type, message }, this.source);
    }

    listen() {
        return new Observable<{ type: MessageType, message: any }>(observer => {
            function _listener(event: MessageEvent) {
                try {
                    if (event.origin !== this._origin) {
                        let { message, type } = event.data;
                        observer.next({ message, type });
                    }
                }
                catch (error) {
                    observer.error(error);
                }
            };

            window.addEventListener('message', _listener, false);

            return () => {
                window.removeEventListener('message', _listener, false);
            };
        });
    }
}

export enum MessageType {
    NEEDS_RELOAD,
    RELOAD,
    ERROR,
    SNIPPET
};<commit_msg>changing enum heirarchy<commit_after>import { Observable } from 'rxjs/Observable';

export class Messenger {
    constructor(public source: string) { }

    send(type: MessageType, message: any) {
        return window.top.postMessage({ type, message }, this.source);
    }

    listen() {
        return new Observable<{ type: MessageType, message: any }>(observer => {
            function _listener(event: MessageEvent) {
                try {
                    if (event.origin !== this._origin) {
                        let { message, type } = event.data;
                        observer.next({ message, type });
                    }
                }
                catch (error) {
                    observer.error(error);
                }
            };

            window.addEventListener('message', _listener, false);

            return () => {
                window.removeEventListener('message', _listener, false);
            };
        });
    }
}

export enum MessageType {
    SNIPPET,
    NEEDS_RELOAD,
    RELOAD,
    ERROR
};
{'fraction_non_alphanumeric': 0.11238095238095239, 'fraction_numerical': 0.0, 'mean_word_length': 1.5161676646706588, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3493861', 'n_tokens_mistral': 543, 'n_tokens_neox': 507, 'n_words': 120}