<commit_before>import {
	Component,
	ElementRef,
	OnInit,
	OnDestroy,
	ViewChild
} from '@angular/core';

import {Observable} from 'rxjs/Observable';
import {Subscription} from 'rxjs/Subscription';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/retry';
import 'rxjs/add/operator/switchMapTo';

import {visible} from '../../shared/animations';
import {MapboxMap, LngLat} from '../../shared/mapbox';
import {MapboxService} from '../../shared/map.service';
import {PoolingService} from '../../shared/pooling.service';
import {IssService} from '../shared/iss.service';
import {IssPosition} from '../shared/position';


@Component({
	selector: 'rj-location',
	templateUrl: './location.component.html',
	styleUrls: [
		'./location.component.scss'
	],
	animations: [
		visible
	]
})
export class LocationComponent implements OnInit, OnDestroy {
	@ViewChild('map', {read: ElementRef}) mapRef: ElementRef;

	private mapbox: Observable<MapboxMap>;
	private position: IssPosition;

	private subs: Subscription[] = [];

	constructor(private iss: IssService, private map: MapboxService, private pooling: PoolingService) {}

	// tslint:disable: no-magic-numbers
	ngOnInit(): void {
		this.mapbox = this.map.create(this.mapRef.nativeElement);
		// NOTE: It will try to get the ISS position if it fails for 10 times before it throws.
		const position = this.pooling.execute(() => this.iss.position()
			.retry(10), 1500);

		this.subs.push(...[
			position.switchMapTo(this.mapbox, (...args: any[]) => args)
				.subscribe(([{coordinates}, map]) => {
					if (!(this.position instanceof IssPosition)) {
						// Render the user (it's location) on the map if it wasn't added.
						const source = map.addPoint(coordinates, {
							'circle-radius': 8,
							'circle-color': '#2196F3',
							'circle-stroke-width': 3,
							'circle-stroke-color': '#F5F5F5'
						});<commit_msg>chore: init Mapbox after view init<commit_after>import {
	AfterViewInit,
	Component,
	ElementRef,
	OnDestroy,
	ViewChild
} from '@angular/core';

import {Observable} from 'rxjs/Observable';
import {Subscription} from 'rxjs/Subscription';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/retry';
import 'rxjs/add/operator/switchMapTo';

import {visible} from '../../shared/animations';
import {MapboxMap, LngLat} from '../../shared/mapbox';
import {MapboxService} from '../../shared/map.service';
import {PoolingService} from '../../shared/pooling.service';
import {IssService} from '../shared/iss.service';
import {IssPosition} from '../shared/position';


@Component({
	selector: 'rj-location',
	templateUrl: './location.component.html',
	styleUrls: [
		'./location.component.scss'
	],
	animations: [
		visible
	]
})
export class LocationComponent implements AfterViewInit, OnDestroy {
	@ViewChild('map', {read: ElementRef}) mapRef: ElementRef;

	private mapbox: Observable<MapboxMap>;
	private position: IssPosition;

	private subs: Subscription[] = [];

	constructor(private iss: IssService, private map: MapboxService, private pooling: PoolingService) {}

	// tslint:disable: no-magic-numbers
	ngAfterViewInit(): void {
		this.mapbox = this.map.create(this.mapRef.nativeElement);
		// NOTE: It will try to get the ISS position if it fails for 10 times before it throws.
		const position = this.pooling.execute(() => this.iss.position()
			.retry(10), 1500);

		this.subs.push(...[
			position.switchMapTo(this.mapbox, (...args: any[]) => args)
				.subscribe(([{coordinates}, map]) => {
					if (!(this.position instanceof IssPosition)) {
						// Render the user (it's location) on the map if it wasn't added.
						const source = map.addPoint(coordinates, {
							'circle-radius': 8,
							'circle-color': '#2196F3',
							'circle-stroke-width': 3,
							'circle-stroke-color': '#F5F5F5'
						});
{'fraction_non_alphanumeric': 0.16068601583113457, 'fraction_numerical': 0.00949868073878628, 'mean_word_length': 4.054666666666667, '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': '3389153', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1193, 'n_words': 303}