<commit_before>import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEventPattern';
import { Subscription } from 'rxjs/Subscription';

export interface BreakpointConfig {
	xs?: string;
	sm?: string;
	md?: string;
	lg?: string;
	[propName: string]: any;
}

const defaultBreakpoints: BreakpointConfig = {
	xs: '(max-width: 767px)',
	sm: '(min-width: 768px) and (max-width: 991px)',
	md: '(min-width: 992px) and (max-width: 1199px)',
	lg: '(min-width: 1200px)'
};

//Main Class
@Injectable()
export class MatchmediaService  {
	private subscription: Subscription;
	public matchmediaCollection: any = {};
	public breakpoints: BreakpointConfig;
	public matchmediaChanges: Observable<any>;

	private setMatchmediaCollection(obj) {
		Object.keys(obj).forEach(prop => {
			this.matchmediaCollection[prop] = window.matchMedia(obj[prop]);
		});
	}

	private addMQHandler(handler) {
		Object.keys(this.matchmediaCollection).forEach(prop => {
			this.matchmediaCollection[prop].addListener(handler);
		});
	}
	
	private removeMQHandler(handler) {
		Object.keys(this.matchmediaCollection).forEach(prop => {
			this.matchmediaCollection[prop].removeListener(handler);<commit_msg>added function wrapper to add 'mediaCustom' property to MediaQueryListEvent as 'media' property is not consistent between browsers<commit_after>import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEventPattern';
import { Subscription } from 'rxjs/Subscription';

export interface BreakpointConfig {
	xs?: string;
	sm?: string;
	md?: string;
	lg?: string;
	[propName: string]: any;
}

const defaultBreakpoints: BreakpointConfig = {
	xs: '(max-width: 767px)',
	sm: '(min-width: 768px) and (max-width: 991px)',
	md: '(min-width: 992px) and (max-width: 1199px)',
	lg: '(min-width: 1200px)'
};

//Main Class
@Injectable()
export class MatchmediaService  {
	private subscription: Subscription;
	public matchmediaCollection: any = {};
	public breakpoints: BreakpointConfig;
	public matchmediaChanges: Observable<any>;

	private setMatchmediaCollection(obj) {
		Object.keys(obj).forEach(prop => {
			this.matchmediaCollection[prop] = window.matchMedia(obj[prop]);
		});
	}

	private addMQHandler(handler) {
		Object.keys(this.matchmediaCollection).forEach(prop => {
			function _handler(){
				arguments[0].mediaCustom = prop;
				handler.apply(this, arguments);
			}
			this.matchmediaCollection[prop].addListener(_handler);
		});
	}
	
	private removeMQHandler(handler) {
		Object.keys(this.matchmediaCollection).forEach(prop => {
			this.matchmediaCollection[prop].removeListener(handler);
{'fraction_non_alphanumeric': 0.13859910581222057, 'fraction_numerical': 0.015275707898658718, 'mean_word_length': 5.695760598503741, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '5943743', 'n_tokens_mistral': 912, 'n_tokens_neox': 838, 'n_words': 181}