1
0
mirror of https://github.com/nolanlawson/pinafore synced 2025-01-22 09:49:57 +01:00
Pinafore-Web-Client-Frontend/routes/_database/knownInstances.js
2018-08-29 19:03:12 -07:00

18 lines
430 B
JavaScript

import { set, keys, del } from 'idb-keyval'
const PREFIX = 'known-instance-'
export async function getKnownInstances () {
return (await keys())
.filter(_ => _.startsWith(PREFIX))
.map(_ => _.substring(PREFIX.length))
}
export async function addKnownInstance (instanceName) {
return set(PREFIX + instanceName, true)
}
export async function deleteKnownInstance (instanceName) {
return del(PREFIX + instanceName)
}