@benliam12/ngx-electron
Version:
An Angular wrapper for Electron's Renderer APIs
102 lines (96 loc) • 3.84 kB
JavaScript
import * as i0 from '@angular/core';
import { Injectable, NgModule } from '@angular/core';
class ElectronService {
get electron() {
if (!this._electron) {
if (window && window.require) {
this._electron = window.require('electron');
return this._electron;
}
return null;
}
return this._electron;
}
/**
* determines if SPA is running in Electron
*/
get isElectronApp() {
return !!window.navigator.userAgent.match(/Electron/);
}
get isMacOS() {
return this.isElectronApp && process.platform === 'darwin';
}
get isWindows() {
return this.isElectronApp && process.platform === 'win32';
}
get isLinux() {
return this.isElectronApp && process.platform === 'linux';
}
get isX86() {
return this.isElectronApp && process.arch === 'ia32';
}
get isX64() {
return this.isElectronApp && process.arch === 'x64';
}
get isArm() {
return this.isElectronApp && process.arch === 'arm';
}
get desktopCapturer() {
return this.electron ? this.electron.desktopCapturer : null;
}
get ipcRenderer() {
return this.electron ? this.electron.ipcRenderer : null;
}
get remote() {
return this.electron ? this.electron.remote : null;
}
get webFrame() {
return this.electron ? this.electron.webFrame : null;
}
get clipboard() {
return this.electron ? this.electron.clipboard : null;
}
get crashReporter() {
return this.electron ? this.electron.crashReporter : null;
}
get process() {
return this.remote ? this.remote.process : null;
}
get nativeImage() {
return this.electron ? this.electron.nativeImage : null;
}
get screen() {
return this.electron ? this.remote.screen : null;
}
get shell() {
return this.electron ? this.electron.shell : null;
}
}
class ElectronServiceRef extends ElectronService {
constructor() {
super();
}
}
ElectronServiceRef.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ElectronServiceRef, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
ElectronServiceRef.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ElectronServiceRef });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ElectronServiceRef, decorators: [{
type: Injectable
}], ctorParameters: function () { return []; } });
class NgxElectronModule {
}
NgxElectronModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NgxElectronModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
NgxElectronModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: NgxElectronModule });
NgxElectronModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NgxElectronModule, providers: [{ provide: ElectronService, useClass: ElectronServiceRef }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: NgxElectronModule, decorators: [{
type: NgModule,
args: [{
declarations: [],
exports: [],
providers: [{ provide: ElectronService, useClass: ElectronServiceRef }]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { ElectronService, ElectronServiceRef, NgxElectronModule };
//# sourceMappingURL=benliam12-ngx-electron.mjs.map