Trying to save a simple GPX.

This commit is contained in:
Eric van der Vlist 2022-11-07 17:04:02 +01:00
parent 510736a33a
commit 2f362916da
4 changed files with 28 additions and 26 deletions

View File

@ -95,6 +95,7 @@ export const setCenterAtom = atom(null, (get, set, center: geoPoint) => {
// initDb(db); // initDb(db);
dispatch({ action: 'initDb' }); dispatch({ action: 'initDb' });
dispatch({ action: 'putNewGpx', params: 'gpxid' });
/** /**
* *

View File

@ -37,21 +37,21 @@ describe('The gpx module', () => {
'xsi:schemaLocation': 'xsi:schemaLocation':
'http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www8.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/WaypointExtension/v1 http://www8.garmin.com/xmlschemas/WaypointExtensionv1.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd', 'http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www8.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/WaypointExtension/v1 http://www8.garmin.com/xmlschemas/WaypointExtensionv1.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd',
}, },
extensions: undefined, extensions: '',
metadata: { metadata: {
author: undefined, author: '',
bounds: undefined, bounds: '',
copyright: undefined, copyright: '',
desc: undefined, desc: '',
extensions: undefined, extensions: '',
keywords: undefined, keywords: '',
link: undefined, link: '',
name: undefined, name: '',
time: '1970-01-01T00:00:00.000Z', time: '1970-01-01T00:00:00.000Z',
}, },
rte: undefined, rte: [],
trk: undefined, trk: [],
wpt: undefined, wpt: [],
}, },
type: 'gpx', type: 'gpx',
}); });

View File

@ -20,20 +20,20 @@ const emptyGpx: Gpx = {
'xmlns:dyo': 'http://xmlns.dyomedea.com/', 'xmlns:dyo': 'http://xmlns.dyomedea.com/',
}, },
metadata: { metadata: {
name: undefined, name: '',
desc: undefined, desc: '',
author: undefined, author: '',
copyright: undefined, copyright: '',
link: undefined, link: '',
time: undefined, time: '',
keywords: undefined, keywords: '',
bounds: undefined, bounds: '',
extensions: undefined, extensions: '',
}, },
wpt: undefined, wpt: [],
rte: undefined, rte: [],
trk: undefined, trk: [],
extensions: undefined, extensions: '',
}; };
export const putNewGpx = (id: string) => { export const putNewGpx = (id: string) => {

View File

@ -1,8 +1,9 @@
import { initDb } from '../db'; import { initDb } from '../db';
import { putNewGpx } from '../db/gpx';
const self = globalThis as unknown as SharedWorkerGlobalScope; const self = globalThis as unknown as SharedWorkerGlobalScope;
const actions = { initDb }; const actions = { initDb, putNewGpx };
self.onconnect = function (e) { self.onconnect = function (e) {
var port = e.ports[0]; var port = e.ports[0];