Gathering detailed insights and metrics for webext-options-sync-per-domain
Gathering detailed insights and metrics for webext-options-sync-per-domain
Gathering detailed insights and metrics for webext-options-sync-per-domain
Gathering detailed insights and metrics for webext-options-sync-per-domain
Helps you manage and autosave your extension's options, separately for each additional permission
npm install webext-options-sync-per-domain
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
17 Stars
35 Commits
1 Forks
2 Watchers
1 Branches
1 Contributors
Updated on Jan 08, 2025
Latest Version
4.3.1
Package Id
webext-options-sync-per-domain@4.3.1
Unpacked Size
16.01 kB
Size
5.52 kB
File Count
5
NPM Version
10.9.0
Node Version
23.1.0
Published on
Jan 08, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Helps you manage and autosave your extension's options, separately for each additional permission.
Prerequisites
In that case, webext-options-sync-per-domain
extends webext-options-sync
with these feature:
origin
permissionsYou can download the standalone bundle and include it in your manifest.json
.
Or use npm
:
1npm install webext-options-sync-per-domain 2npm remove webext-options-sync # This is now included
If you're following the suggested setup for webext-options-sync
, here are the changes you should make:
Before | After |
---|---|
|
|
Now options-storage.js
will export the same old OptionsSync
instance, but it will very depending on the current domain.
You'll also need to change 2 lines on the options page:
Before | After |
---|---|
|
|
That's all! A domain switcher will only appear if the user adds new additional domains via chrome.permissions.request()
or webext-permission-toggle.
Origins are what the browser calls each "website" permission; they look like https://example.com
or https://*.example.com/*
Domains are the same as origins, except it's a less ambiguous word and it's generally shown protocol-less: example.com
or *.example.com
webext-options-sync-per-domain
differentiates between origins that are part of manifest.json
and origins added later via chrome.permission.request()
. All manifest.json
origins share the same options and these are considered the "default".
This is identical to the setup
in webext-options-sync
This is identical to syncForm()
in webext-options-sync
, but it will also:
If you want to customize the switcher or listen to its change, await
this call and perform the changes after it runs. Example:
1// options.js 2import {perDomainOptions} from './options-storage'; 3 4async initOptions() { 5 await perDomainOptions.syncForm('form'); 6 7 // Update domain-dependent page content when the domain is changed 8 const dropdown = document.querySelector('.OptionsSyncPerDomain-picker select'); 9 if (dropdown) { 10 dropdown.addEventListener('change', () => { 11 select('#personal-token-link')!.host = dropdown.value === 'default' ? 'github.com' : dropdown.value; 12 }); 13 } 14} 15 16initOptions();
Returns an origin-specific instance of OptionsSync. If called from an extension page (background.js, options.html, etc) and without the parameter, it will use the default origin.
Type: string
Default: location.origin
Example: http://example.com
Returns a list of all the origins that have been added via chrome.permissions.request()
. This is useful if you want to display a list of domains that the user can choose from. This method does not include the default origins.
1const origins = await perDomainOptions.getAdditionalOrigins(); 2 3console.log('The user enabled the extension on:', ...origins);
Returns a Map
of the OptionsSync
instances, one for each origin. The default origins are on the key default
and the other ones are on keys that look like domain.ext
1const instances = perDomainOptions.getAllOrigins(); 2 3// Print the options of these 2 instances 4console.log(await instances.get('default').getAll()); 5console.log(await instances.get('example.com').getAll());
MIT © Federico Brigante
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More