Compare commits
5 Commits
b3fd092acf
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
d36bef185c
|
|||
|
b84010a332
|
|||
|
05516e7642
|
|||
|
22c6b02e4b
|
|||
|
e859bc3ee7
|
60
README.md
60
README.md
@@ -1,6 +1,6 @@
|
|||||||
# @remotestorage/module-places
|
# @remotestorage/module-places
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@remotestorage/module-places)
|
[](https://www.npmjs.com/package/@remotestorage/module-places) [](https://gitea.kosmos.org/raucao/remotestorage-module-places/actions)
|
||||||
|
|
||||||
This module allows you to manage saved places (Points of Interest) using the [remoteStorage](https://remotestorage.io/) protocol.
|
This module allows you to manage saved places (Points of Interest) using the [remoteStorage](https://remotestorage.io/) protocol.
|
||||||
|
|
||||||
@@ -11,7 +11,17 @@ For a demo application, as well as source code using this module, check out [Mar
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# npm
|
||||||
|
npm install @remotestorage/module-places
|
||||||
|
|
||||||
|
# pnpm
|
||||||
pnpm add @remotestorage/module-places
|
pnpm add @remotestorage/module-places
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn add @remotestorage/module-places
|
||||||
|
|
||||||
|
# bun
|
||||||
|
bun add @remotestorage/module-places
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -41,12 +51,56 @@ console.log(allPlaces);
|
|||||||
// List places for specific geohash prefixes (e.g. for a map view)
|
// List places for specific geohash prefixes (e.g. for a map view)
|
||||||
const areaPlaces = await places.getPlaces(['u33d', 'u33e']);
|
const areaPlaces = await places.getPlaces(['u33d', 'u33e']);
|
||||||
console.log(areaPlaces);
|
console.log(areaPlaces);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Lists
|
||||||
|
|
||||||
|
### Default lists
|
||||||
|
|
||||||
|
There are currently two default lists, which you can initiate like this:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
await places.lists.initDefaults();
|
||||||
|
```
|
||||||
|
|
||||||
|
This will create the lists if they don't exist yet (meaning the user hasn't yet
|
||||||
|
used an app that integrates this module).
|
||||||
|
|
||||||
|
The default lists are:
|
||||||
|
|
||||||
|
| Path | Default Name | Default Color |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `_lists/to-go` | Want to go | #2e9e4f (green) |
|
||||||
|
| `_lists/to-do` | To do | #2a7fff (blue) |
|
||||||
|
|
||||||
|
### Custom lists
|
||||||
|
|
||||||
|
```javascript
|
||||||
// Create a list
|
// Create a list
|
||||||
await places.lists.create('favorites', 'My Favorites');
|
await places.lists.create('hiking', 'Hiking', '#74d3ba');
|
||||||
|
|
||||||
|
// Delete a list
|
||||||
|
await places.lists.delete('hiking');
|
||||||
|
```
|
||||||
|
|
||||||
|
### List membership
|
||||||
|
|
||||||
|
```javascript
|
||||||
// Add a place to a list (requires list ID, place ID, and place geohash)
|
// Add a place to a list (requires list ID, place ID, and place geohash)
|
||||||
await places.lists.addPlace('favorites', 'place-id-123', 'u33dc0');
|
await places.lists.addPlace('to-go', 'place-id-123', 'u33dc0');
|
||||||
|
|
||||||
|
// Remove from list
|
||||||
|
await places.lists.removePlace('to-go', 'place-id-123');
|
||||||
|
```
|
||||||
|
|
||||||
|
### Reading lists
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Get all lists
|
||||||
|
await places.lists.getAll();
|
||||||
|
|
||||||
|
// Get specific list
|
||||||
|
await places.lists.get('to-do');
|
||||||
```
|
```
|
||||||
|
|
||||||
## API Reference
|
## API Reference
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@remotestorage/module-places",
|
"name": "@remotestorage/module-places",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@remotestorage/module-places",
|
"name": "@remotestorage/module-places",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"latlon-geohash": "^2.0.0",
|
"latlon-geohash": "^2.0.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@remotestorage/module-places",
|
"name": "@remotestorage/module-places",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"description": "Manage favorite/saved places",
|
"description": "Manage favorite/saved places",
|
||||||
"homepage": "https://gitea.kosmos.org/raucao/remotestorage-module-places#remotestoragemodule-places",
|
"homepage": "https://gitea.kosmos.org/raucao/remotestorage-module-places#remotestoragemodule-places",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in New Issue
Block a user