@@ -5,24 +5,34 @@ import {
55 windowListen ,
66 windowPost ,
77} from './api/communication.ts' ;
8- import { getSettings , onSettingsChange } from './api/settings.ts' ;
9- import { getSession , onSessionChange } from './api/session.ts' ;
8+ import { loadLocalStorage , onLocalStorageChange } from './api/storage.local.ts' ;
9+ import {
10+ loadSessionStorage ,
11+ onSessionStorageChange ,
12+ } from './api/storage.session.ts' ;
13+
14+ Promise . all ( [ loadLocalStorage ( ) , loadSessionStorage ( ) ] ) . then (
15+ ( [ config , session ] ) => {
16+ windowPost ( { msg : EMsg . CONFIG , config } ) ;
17+ windowPost ( { msg : EMsg . SESSION , session } ) ;
1018
11- Promise . all ( [ getSettings ( ) , getSession ( ) ] ) . then ( ( [ settings , session ] ) => {
12- windowPost ( { msg : EMsg . SETTINGS , settings } ) ;
13- windowPost ( { msg : EMsg . SESSION , session } ) ;
19+ if ( config . devtoolsPanelShown && ! config . paused ) {
20+ windowPost ( { msg : EMsg . START_OBSERVE } ) ;
21+ }
1422
15- portListen ( windowPost ) ;
16- windowListen ( runtimePost ) ;
23+ portListen ( windowPost ) ;
24+ windowListen ( runtimePost ) ;
1725
18- onSettingsChange ( ( newValue ) => {
19- windowPost ( { msg : EMsg . SETTINGS , settings : newValue } ) ;
20- } ) ;
21- onSessionChange ( ( newValue ) => {
22- windowPost ( { msg : EMsg . SESSION , session : newValue } ) ;
23- } ) ;
26+ onLocalStorageChange ( ( newValue ) => {
27+ windowPost ( { msg : EMsg . CONFIG , config : newValue } ) ;
28+ } ) ;
29+ onSessionStorageChange ( ( newValue ) => {
30+ windowPost ( { msg : EMsg . SESSION , session : newValue } ) ;
31+ } ) ;
2432
25- runtimePost ( { msg : EMsg . CONTENT_SCRIPT_LOADED } ) ;
33+ runtimePost ( { msg : EMsg . CONTENT_SCRIPT_LOADED } ) ;
2634
27- __development__ && console . log ( 'api-monitor-cs-isolated.ts' , performance . now ( ) ) ;
28- } ) ;
35+ __development__ &&
36+ console . log ( 'api-monitor-cs-isolated.ts' , performance . now ( ) ) ;
37+ } ,
38+ ) ;
0 commit comments