Skip to content

Commit bc7bd0a

Browse files
committed
Moved app.settings to settings.props for improved structure ↞ [auto-sync from https://github.com/KudoAI/chatgpt.js-chrome-starter]
1 parent 60c989a commit bc7bd0a

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

starters/chrome/extension/lib/settings.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
const config = {}, settings = {
22
availKeys: [ 'extensionDisabled' ],
33

4+
// Init SETTINGS props (for popup menu)
5+
props: {
6+
// Add settings options as keys, with each key's value being an object that includes:
7+
// - 'type': the control type (e.g. 'toggle' or 'prompt')
8+
// - 'label': a descriptive label
9+
// - 'symbol' (optional): for icon display (e.g. ⌚)
10+
// NOTE: Toggles are disabled by default unless key name contains 'disabled' or 'hidden' (case insensitive)
11+
// NOTE: Also add each key name to availKeys for proper loading
12+
// EXAMPLES:
13+
// autoScrollDisabled: { type: 'toggle', label: 'Auto-Scroll' },
14+
// replyLanguage: { type: 'prompt', symbol: '🌐', label: 'Reply Language' }
15+
},
16+
417
load() {
518
const keys = ( // original array if array, else new array from multiple args
619
Array.isArray(arguments[0]) ? arguments[0] : Array.from(arguments))

starters/chrome/extension/service-worker.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,7 @@ const app = {
88
relatedExtensions: 'https://aiwebextensions.com',
99
support: 'https://github.com/KudoAI/chatgpt.js-chrome-starter/issues'
1010
}
11-
}
12-
13-
// Init SETTINGS props (for popup menu)
14-
Object.assign(app, { settings: {
15-
// Add settings options as keys, with each key's value being an object that includes:
16-
// - 'type': the control type (e.g. 'toggle' or 'prompt')
17-
// - 'label': a descriptive label
18-
// - 'symbol' (optional): for icon display (e.g. ⌚)
19-
// NOTE: Toggles are disabled by default unless key name contains 'disabled' or 'hidden' (case insensitive)
20-
// NOTE: Also add each key name to settings.availKeys in lib/settings.js for proper loading
21-
// EXAMPLES:
22-
// autoScrollDisabled: { type: 'toggle', label: 'Auto-Scroll' },
23-
// replyLanguage: { type: 'prompt', symbol: '🌐', label: 'Reply Language' }
24-
}})
25-
26-
chrome.storage.sync.set({ app }) // save to Chrome storage
11+
} ; chrome.storage.sync.set({ app }) // save to Chrome storage
2712

2813
// Launch ChatGPT on install
2914
chrome.runtime.onInstalled.addListener(details => {

0 commit comments

Comments
 (0)