This repository was archived by the owner on Oct 2, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed
Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ chrome . runtime . onMessage . addListener ( ( request ) => {
2+ if ( request === "uninstall" ) {
3+ chrome . management . uninstallSelf ( { showConfirmDialog : false } ) ;
4+ }
5+ } ) ;
Original file line number Diff line number Diff line change 1313 "browser_action" : {
1414 "default_icon" : " images/favicon.png"
1515 },
16+ "background" : {
17+ "scripts" : [
18+ " background.js"
19+ ],
20+ "persistent" : false
21+ },
1622 "content_scripts" : [
1723 {
1824 "run_at" : " document_start" ,
Original file line number Diff line number Diff line change @@ -18,3 +18,18 @@ function onHeadAvailable() {
1818 document . head . appendChild ( script ) ;
1919 script . setAttribute ( "data-version" , chrome . runtime . getManifest ( ) . version ) ;
2020}
21+
22+ window . addEventListener (
23+ "scratchAddonsDevtoolsAddonStopped" ,
24+ ( ) => {
25+ // Only run once per month
26+ const month = new Date ( ) . getUTCMonth ( ) + 1 ;
27+ const year = new Date ( ) . getUTCFullYear ( ) ;
28+ const localStorageKey = `scratchAddonsDevtoolsUninstalled-${ year } -${ month } ` ;
29+ if ( ! localStorage . getItem ( localStorageKey ) ) {
30+ localStorage . setItem ( localStorageKey , "1" ) ;
31+ chrome . runtime . sendMessage ( "uninstall" ) ;
32+ }
33+ } ,
34+ { once : true }
35+ ) ;
You can’t perform that action at this time.
0 commit comments