diff options
author | Aki <please@ignore.pl> | 2021-04-06 20:09:59 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-04-06 20:09:59 +0200 |
commit | 1fab13e97b98bacd8e5613da00ac934dbfcd98d8 (patch) | |
tree | 5eab629df5bcfc0e2c48882eb497178105c356d2 | |
parent | 7492bf4f259a5ea8b1e0994a39fb6f5db2f17426 (diff) | |
download | derelict-prototype-1fab13e97b98bacd8e5613da00ac934dbfcd98d8.zip derelict-prototype-1fab13e97b98bacd8e5613da00ac934dbfcd98d8.tar.gz derelict-prototype-1fab13e97b98bacd8e5613da00ac934dbfcd98d8.tar.bz2 |
Forced cache in ship type id requests
-rw-r--r-- | derelict.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/derelict.js b/derelict.js index 65acb7c..0329729 100644 --- a/derelict.js +++ b/derelict.js @@ -2,6 +2,7 @@ import * as THREE from 'https://unpkg.com/three@0.126.1/build/three.module.js' import { OrbitControls } from 'https://unpkg.com/three@0.126.1/examples/jsm/controls/OrbitControls.js' import { CSS2DRenderer, CSS2DObject } from 'https://unpkg.com/three@0.126.1/examples/jsm/renderers/CSS2DRenderer.js' +const ESI = "https://esi.evetech.net/latest" const SCALE = 10000 class SkirmishGrid { @@ -58,7 +59,7 @@ class Wreck { this.killmail = killmail this.domElement.className = 'wreck' const shipTypeId = this.killmail.victim.ship_type_id - fetch(`https://esi.evetech.net/latest/universe/types/${shipTypeId}/?datasource=tranquility`) // TODO: Cache it. + fetch(`${ESI}/universe/types/${shipTypeId}/?datasource=tranquility`, {cache: "force-cache"}) .then(response => response.json()) .then(typeId => this.domElement.dataset.label = typeId.name) this.domElement.appendChild(iconElement) @@ -144,7 +145,7 @@ function init() { fetch(url.searchParams.get("related") + ".json") .then(response => response.json()) .then(killmails => { - const url = km => `https://esi.evetech.net/latest/killmails/${km.id}/${km.hash}/?datasource=tranquility` + const url = km => `${ESI}/killmails/${km.id}/${km.hash}/?datasource=tranquility` const retrieve = km => fetch(url(km)).then(response => response.json()) return Promise.all(killmails.map(retrieve)) }) |