tabby/terminus-core/src/services/electron.service.ts
Eugene Pankov 9312db1fc6 fixed #126
2017-07-24 14:48:16 +02:00

35 lines
999 B
TypeScript

import { Injectable } from '@angular/core'
@Injectable()
export class ElectronService {
app: any
ipcRenderer: any
shell: any
dialog: any
clipboard: any
globalShortcut: any
screen: any
remote: any
private electron: any
constructor () {
this.electron = require('electron')
this.remote = this.electron.remote
this.app = this.electron.remote.app
this.screen = this.electron.remote.screen
this.dialog = this.electron.remote.dialog
this.shell = this.electron.shell
this.clipboard = this.electron.clipboard
this.ipcRenderer = this.electron.ipcRenderer
this.globalShortcut = this.electron.remote.globalShortcut
}
remoteRequire (name: string): any {
return this.remote.require(name)
}
remoteRequirePluginModule (plugin: string, module: string, globals: any): any {
return this.remoteRequire(globals.require.resolve(`${plugin}/node_modules/${module}`))
}
}