File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 1+ import { extractHostname } from "./extract-hostname" ;
2+
13export class ActiveTab {
24 private static instance : ActiveTab ;
3- private _activeTab : string | null ;
5+ private _activeTabUrl : string | null ;
6+ private _activeTabDomain : string | null ;
47
58 constructor ( ) {
69 if ( ActiveTab . instance ) {
710 throw new Error ( "Error - use ActiveTab.getInstance()" ) ;
811 }
9- this . _activeTab = null ;
12+ this . _activeTabUrl = null ;
13+ this . _activeTabDomain = null ;
1014 }
1115
1216 static getInstance ( ) : ActiveTab {
@@ -16,11 +20,17 @@ export class ActiveTab {
1620
1721 public setActiveTab ( value :string | null ) : void
1822 {
19- this . _activeTab = value ;
23+ this . _activeTabUrl = value ;
24+ this . _activeTabDomain = value != null ? extractHostname ( value ) : null ;
25+ }
26+
27+ public getActiveTabUrl ( ) : string | null
28+ {
29+ return this . _activeTabUrl ;
2030 }
2131
22- public getActiveTab ( ) : string | null
32+ public getActiveTabDomain ( ) : string | null
2333 {
24- return this . _activeTab ;
34+ return this . _activeTabDomain ;
2535 }
2636}
You can’t perform that action at this time.
0 commit comments