Verifying simple script messaging.
This commit is contained in:
@@ -10,7 +10,8 @@ const storage = browser.storage.local;
|
||||
|
||||
browser.runtime.onInstalled.addListener(async ({ reason }) => {
|
||||
// I would like to be able to skip this for development purposes
|
||||
let ignoreHook = (await storage.get('ignoreInstallHook')).ignoreInstallHook;
|
||||
let ignoreHook = (await storage.get({ ignoreInstallHook: false }))
|
||||
.ignoreInstallHook;
|
||||
if (ignoreHook === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,13 @@
|
||||
|
||||
<body x-data="options" class="text-fuchsia-900 bg-fuchsia-400">
|
||||
<h1 class="text-6xl font-bold">Settings</h1>
|
||||
<p x-text="msg"></p>
|
||||
|
||||
<select x-model.number="profileIndex" name="profiles" id="profiles">
|
||||
<template x-for="(profileName, index) in profileNames" :key="profileName">
|
||||
<option x-text="profileName" :value="index"></option>
|
||||
</template>
|
||||
</select>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -2,6 +2,18 @@ import Alpine from 'alpinejs';
|
||||
|
||||
Alpine.data('options', () => ({
|
||||
msg: 'Hello world!',
|
||||
profileNames: ['Default'],
|
||||
profileIndex: 0,
|
||||
|
||||
async init() {
|
||||
await this.getProfileNames();
|
||||
},
|
||||
|
||||
async getProfileNames() {
|
||||
this.profileNames = await browser.runtime.sendMessage({
|
||||
kind: 'getProfileNames',
|
||||
});
|
||||
},
|
||||
}));
|
||||
|
||||
Alpine.start();
|
||||
|
||||
Reference in New Issue
Block a user