MCPcopy
hub / github.com/Eugeny/tabby / constructor

Method constructor

tabby-electron/src/services/touchbar.service.ts:12–38  ·  view source on GitHub ↗
(
        private app: AppService,
        private hostApp: HostAppService,
        private zone: NgZone,
    )

Source from the content-addressed store, hash-verified

10 private touchbarState$ = new Subject<any>()
11
12 private constructor (
13 private app: AppService,
14 private hostApp: HostAppService,
15 private zone: NgZone,
16 ) {
17 if (this.hostApp.platform !== Platform.macOS) {
18 return
19 }
20 app.tabsChanged$.subscribe(() => this.update())
21 app.activeTabChange$.subscribe(() => this.update())
22
23 app.tabOpened$.subscribe(tab => {
24 tab.titleChange$.subscribe(() => this.update())
25 tab.activity$.pipe(
26 map(x => !x || tab === app.activeTab),
27 distinctUntilChanged(),
28 ).subscribe(() => this.update())
29 })
30
31 ipcRenderer.on('touchbar-selection', (_event, index) => this.zone.run(() => {
32 this.app.selectTab(this.app.tabs[index])
33 }))
34
35 this.touchbarState$.pipe(distinctUntilChanged(deepEqual)).subscribe(state => {
36 ipcRenderer.send('window-set-touch-bar', ...state)
37 })
38 }
39
40 update (): void {
41 if (this.hostApp.platform !== Platform.macOS) {

Callers

nothing calls this directly

Calls 6

updateMethod · 0.95
onMethod · 0.80
selectTabMethod · 0.80
subscribeMethod · 0.45
runMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected