@globalfishingwatch/layer-composer
Advanced tools
Comparing version 0.5.1-fork1 to 0.5.1-fork2
@@ -32,3 +32,3 @@ "use strict"; | ||
var heatmap_layers_paint_1 = __importDefault(require("./heatmap-layers-paint")); | ||
var mem_1 = __importDefault(require("mem")); | ||
var memoize_one_1 = __importDefault(require("memoize-one")); | ||
var utils_1 = require("../../utils"); | ||
@@ -134,3 +134,3 @@ exports.HEATMAP_TYPE = 'HEATMAP'; | ||
} | ||
return fetch(statsUrl.toString()) | ||
return fetch(statsUrl.toString(), { cache: 'force-cache' }) | ||
.then(function (r) { return r.json(); }) | ||
@@ -142,3 +142,3 @@ .then(function (r) { | ||
var max = r.max + 0.001; | ||
_this.stats = { | ||
var stats = { | ||
min: min, | ||
@@ -148,3 +148,5 @@ median: median, | ||
}; | ||
_this.stats = stats; | ||
_this.loadingStats = false; | ||
return stats; | ||
}); | ||
@@ -315,5 +317,3 @@ }; | ||
utils_1.memoizeByLayerId(layer.id, { | ||
_fetchStats: mem_1.default(_this._fetchStats, { | ||
cacheKey: function (arguments_) { return arguments_.join(','); }, | ||
}), | ||
_fetchStats: memoize_one_1.default(_this._fetchStats), | ||
}); | ||
@@ -320,0 +320,0 @@ if (!_this.delta) { |
@@ -34,3 +34,7 @@ /// <reference types="lodash" /> | ||
_getServerSideFilters: (serverSideFilter: string | undefined, start: string, end: string, useStartAndEnd?: boolean) => string; | ||
_fetchStats: (tileset: string, zoom: number, serverSideFilters: string) => Promise<void>; | ||
_fetchStats: (tileset: string, zoom: number, serverSideFilters: string) => Promise<{ | ||
min: number; | ||
median: any; | ||
max: any; | ||
}>; | ||
_getStyleSources: (layer: HeatmapGeneratorConfig) => { | ||
@@ -37,0 +41,0 @@ id: string; |
{ | ||
"name": "@globalfishingwatch/layer-composer", | ||
"version": "0.5.1-fork1", | ||
"version": "0.5.1-fork2", | ||
"description": "Tools to convert layer configuration to data structures needed in Mapbox GL GFW interactive maps ", | ||
@@ -53,3 +53,2 @@ "keywords": [ | ||
"lodash": "^4.17.15", | ||
"mem": "^6.0.1", | ||
"memoize-one": "^5.1.1", | ||
@@ -56,0 +55,0 @@ "pbf": "^3.2.1", |
@@ -8,3 +8,3 @@ import flatten from 'lodash/flatten' | ||
import paintByGeomType from './heatmap-layers-paint' | ||
import mem from 'mem' | ||
import memoizeOne from 'memoize-one' | ||
import { memoizeByLayerId, memoizeCache } from '../../utils' | ||
@@ -140,3 +140,3 @@ | ||
} | ||
return fetch(statsUrl.toString()) | ||
return fetch(statsUrl.toString(), { cache: 'force-cache' }) | ||
.then((r) => r.json()) | ||
@@ -148,3 +148,3 @@ .then((r) => { | ||
const max = r.max + 0.001 | ||
this.stats = { | ||
const stats = { | ||
min, | ||
@@ -154,4 +154,5 @@ median, | ||
} | ||
this.stats = stats | ||
this.loadingStats = false | ||
return stats | ||
}) | ||
@@ -359,5 +360,3 @@ } | ||
memoizeByLayerId(layer.id, { | ||
_fetchStats: mem(this._fetchStats, { | ||
cacheKey: (arguments_) => arguments_.join(','), | ||
}), | ||
_fetchStats: memoizeOne(this._fetchStats), | ||
}) | ||
@@ -364,0 +363,0 @@ if (!this.delta) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
11
1075799
12502
- Removedmem@^6.0.1
- Removedmap-age-cleaner@0.1.3(transitive)
- Removedmem@6.1.1(transitive)
- Removedmimic-fn@3.1.0(transitive)
- Removedp-defer@1.0.0(transitive)