2020-11-25 00:37:10 +01:00
|
|
|
import { set, keys, del } from '../_thirdparty/idb-keyval/idb-keyval'
|
2018-08-30 04:03:12 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
}
|