timeline-map
Advanced tools
Comparing version 1.2.2 to 1.3.0
{ | ||
"name": "timeline-map", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "TimeLine Map Component from MapsForAll", | ||
@@ -8,3 +8,3 @@ "main": "dist/TimeLineMap.js", | ||
"build": "webpack --mode production", | ||
"dev": "webpack --mode development --output-path ../webmap/node_modules/timeline-map/dist/ --watch", | ||
"dev": "webpack --mode development --output-path ../maps4us/node_modules/timeline-map/dist/ --watch", | ||
"test": "mocha -r ts-node/register --colors ./test/*.spec.ts --exit", | ||
@@ -11,0 +11,0 @@ "lint": "eslint --ext .js,.ts src/", |
@@ -46,4 +46,10 @@ import axios from 'axios'; | ||
export async function fetch(mapId: string): Promise<{markers: Marker[]; metaData: MetaData}> { | ||
const response = await axios.get(`https://mapsforall-96ddd.firebaseio.com/publishedMaps/${mapId}.json`); | ||
export async function fetch( | ||
mapId: string, | ||
incrementViewCount: boolean | ||
): Promise<{markers: Marker[]; metaData: MetaData}> { | ||
const response = await axios.get( | ||
`https://us-central1-mapsforall-96ddd.cloudfunctions.net/getPublishedMap?` + | ||
`mapId=${mapId}&incrementViewCount=${incrementViewCount.toString()}` | ||
); | ||
let {markers, persons, ...metaData} = response.data; | ||
@@ -50,0 +56,0 @@ markers = markers ? markers : persons; |
@@ -12,2 +12,3 @@ import {DateMode} from '../date/dateMode'; | ||
maxDate: Date; | ||
viewCount?: number; | ||
} |
@@ -33,5 +33,5 @@ import {Marker} from './marker/marker'; | ||
public async create(): Promise<void> { | ||
public async create(incrementViewCount = false): Promise<void> { | ||
this.google = await fetchGoogle(); | ||
await this.getMapData(); | ||
await this.getMapData(incrementViewCount); | ||
this.createMap(); | ||
@@ -63,4 +63,4 @@ this.createSlider(); | ||
private async getMapData(): Promise<void> { | ||
({markers: this.markers, metaData: this.metaData} = await fetch(this.mapId)); | ||
private async getMapData(incrementViewCount: boolean): Promise<void> { | ||
({markers: this.markers, metaData: this.metaData} = await fetch(this.mapId, incrementViewCount)); | ||
this.sendMetaData(this.metaData); | ||
@@ -67,0 +67,0 @@ this.update(this.markers); |
@@ -7,5 +7,5 @@ /* global describe, it, before */ | ||
it('should return markers', async () => { | ||
const markers = await fetch('1512409330904'); | ||
const markers = await fetch('1512409330904', false); | ||
expect(markers).to.not.be.empty; | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
143785
1198