Added page for Experimental features, with NIP-26 support.

This commit is contained in:
Ryan Breen
2023-02-06 20:45:20 -05:00
parent 2aabd443e1
commit 6c83c24921
14 changed files with 363 additions and 49 deletions

View File

@@ -0,0 +1,40 @@
import Alpine from 'alpinejs';
const FEATURES = [
[
'delegation',
'NIP-26 Delegation Profiles',
'Allow user to create delegated profiles that obey the NIP-26 standard. Requires client support.',
],
];
Alpine.data('experimental', () => ({
features: [],
async init() {
await this.reloadFeatures();
console.log(this.features);
},
async reloadFeatures() {
this.features = await Promise.all(
FEATURES.map(async ([name, shortDesc, longDesc]) => {
name = `feature:${name}`;
let active = await browser.storage.local.get({
[name]: false,
});
active = active[name];
return [name, active, shortDesc, longDesc];
})
);
},
async change(feature, active) {
console.log(feature, active);
await browser.storage.local.set({ [feature]: active });
await this.reloadFeatures();
},
}));
Alpine.start();