Add remoteStorage.js and Places module
Some checks failed
CI / Lint (push) Has been cancelled
CI / Test (push) Has been cancelled

This commit is contained in:
2026-01-15 20:45:07 +07:00
parent 283b73e0e6
commit caa48537bc
8 changed files with 127 additions and 22 deletions

View File

@@ -26,7 +26,6 @@ const setupMap = modifier((element) => {
});
apply(openfreemap, 'https://tiles.openfreemap.org/styles/positron');
});
<template>

28
app/services/storage.js Normal file
View File

@@ -0,0 +1,28 @@
import Service from '@ember/service';
import RemoteStorage from 'remotestoragejs';
import Places from '@remotestorage/module-places';
import Widget from 'remotestorage-widget';
export default class StorageService extends Service {
rs;
constructor() {
super(...arguments);
console.log('ohai');
this.rs = new RemoteStorage({
modules: [Places],
});
this.rs.access.claim('places', 'rw');
this.rs.caching.enable('/places/');
window.remoteStorage = this.rs;
// const widget = new Widget(this.rs);
// widget.attach();
}
get places() {
return this.rs.places;
}
}

View File

@@ -1,15 +0,0 @@
import { useLegacyStore } from '@warp-drive/legacy';
import { JSONAPICache } from '@warp-drive/json-api';
const Store = useLegacyStore({
linksMode: true,
cache: JSONAPICache,
handlers: [
// -- your handlers here
],
schemas: [
// -- your schemas here
],
});
export default Store;

View File

@@ -18,3 +18,11 @@ body {
[style*='position: absolute; inset: 0;'] {
background: #f8f9fa;
}
/* Ensure RS widget is above the map */
#remotestorage-widget {
position: absolute;
top: 10px;
right: 10px;
z-index: 1000;
}

View File

@@ -1,10 +1,23 @@
import Component from '@glimmer/component';
import { pageTitle } from 'ember-page-title';
import Map from '#components/map';
import { service } from '@ember/service';
<template>
{{pageTitle "M/\RCO"}}
export default class ApplicationComponent extends Component {
@service storage;
<Map />
constructor() {
super(...arguments);
console.log('Application component constructed');
// Access the service to ensure it is instantiated
this.storage;
}
{{outlet}}
</template>
<template>
{{pageTitle "M/\RCO"}}
<Map />
{{outlet}}
</template>
}