support of electron is added

This commit is contained in:
병준 박 2019-05-13 02:18:24 +09:00
parent e0c25a6884
commit c12530c189
17 changed files with 368 additions and 42 deletions

View File

@ -15,8 +15,12 @@
}, },
"architect": { "architect": {
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-builders/custom-webpack:browser",
"options": { "options": {
"customWebpackConfig": {
"path": "projects/odds-crawler-frontend-app/custom-webpack.config.js",
"replaceDuplicatePlugins": true
},
"outputPath": "dist/odds-crawler-frontend-app", "outputPath": "dist/odds-crawler-frontend-app",
"index": "projects/odds-crawler-frontend-app/src/index.html", "index": "projects/odds-crawler-frontend-app/src/index.html",
"main": "projects/odds-crawler-frontend-app/src/main.ts", "main": "projects/odds-crawler-frontend-app/src/main.ts",

240
package-lock.json generated
View File

@ -4,6 +4,15 @@
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@angular-builders/custom-webpack": {
"version": "7.4.3",
"resolved": "https://nexus.loafle.net/repository/npm-all/@angular-builders/custom-webpack/-/custom-webpack-7.4.3.tgz",
"integrity": "sha512-dizPcKBSdgM8ztVbhOdVxHnfV/FBkTi1ZirsxWaw1B0S0KuPTESnsJaZA15i8Y2l202hCPs5fJfqy5aCoRrs1Q==",
"dev": true,
"requires": {
"lodash": "^4.17.10"
}
},
"@angular-devkit/architect": { "@angular-devkit/architect": {
"version": "0.13.9", "version": "0.13.9",
"resolved": "https://nexus.loafle.net/repository/npm-all/@angular-devkit/architect/-/architect-0.13.9.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/@angular-devkit/architect/-/architect-0.13.9.tgz",
@ -737,6 +746,15 @@
"semver-intersect": "1.4.0" "semver-intersect": "1.4.0"
} }
}, },
"@types/electron": {
"version": "1.6.10",
"resolved": "https://nexus.loafle.net/repository/npm-all/@types/electron/-/electron-1.6.10.tgz",
"integrity": "sha512-MOCVyzIwkBEloreoCVrTV108vSf8fFIJPsGruLCoAoBZdxtnJUqKA4lNonf/2u1twSjAspPEfmEheC+TLm/cMw==",
"dev": true,
"requires": {
"electron": "*"
}
},
"@types/estree": { "@types/estree": {
"version": "0.0.39", "version": "0.0.39",
"resolved": "https://nexus.loafle.net/repository/npm-all/@types/estree/-/estree-0.0.39.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/@types/estree/-/estree-0.0.39.tgz",
@ -3127,6 +3145,70 @@
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=",
"dev": true "dev": true
}, },
"electron": {
"version": "5.0.1",
"resolved": "https://nexus.loafle.net/repository/npm-all/electron/-/electron-5.0.1.tgz",
"integrity": "sha512-8KksyhAPcpXVeO8ViVGxfZAuf8yEVBCtV0h/lMBD8VFbCQ9icej1K5csCFAGirbZbqOz5IdsBZX9Gpb9n4RCag==",
"dev": true,
"requires": {
"@types/node": "^10.12.18",
"electron-download": "^4.1.0",
"extract-zip": "^1.0.3"
},
"dependencies": {
"@types/node": {
"version": "10.14.6",
"resolved": "https://nexus.loafle.net/repository/npm-all/@types/node/-/node-10.14.6.tgz",
"integrity": "sha512-Fvm24+u85lGmV4hT5G++aht2C5I4Z4dYlWZIh62FAfFO/TfzXtPpoLI6I7AuBWkIFqZCnhFOoTT7RjjaIL5Fjg==",
"dev": true
}
}
},
"electron-download": {
"version": "4.1.1",
"resolved": "https://nexus.loafle.net/repository/npm-all/electron-download/-/electron-download-4.1.1.tgz",
"integrity": "sha512-FjEWG9Jb/ppK/2zToP+U5dds114fM1ZOJqMAR4aXXL5CvyPE9fiqBK/9YcwC9poIFQTEJk/EM/zyRwziziRZrg==",
"dev": true,
"requires": {
"debug": "^3.0.0",
"env-paths": "^1.0.0",
"fs-extra": "^4.0.1",
"minimist": "^1.2.0",
"nugget": "^2.0.1",
"path-exists": "^3.0.0",
"rc": "^1.2.1",
"semver": "^5.4.1",
"sumchecker": "^2.0.2"
},
"dependencies": {
"debug": {
"version": "3.2.6",
"resolved": "https://nexus.loafle.net/repository/npm-all/debug/-/debug-3.2.6.tgz",
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
},
"fs-extra": {
"version": "4.0.3",
"resolved": "https://nexus.loafle.net/repository/npm-all/fs-extra/-/fs-extra-4.0.3.tgz",
"integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"ms": {
"version": "2.1.1",
"resolved": "https://nexus.loafle.net/repository/npm-all/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==",
"dev": true
}
}
},
"electron-to-chromium": { "electron-to-chromium": {
"version": "1.3.133", "version": "1.3.133",
"resolved": "https://nexus.loafle.net/repository/npm-all/electron-to-chromium/-/electron-to-chromium-1.3.133.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/electron-to-chromium/-/electron-to-chromium-1.3.133.tgz",
@ -3269,6 +3351,12 @@
"integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=", "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=",
"dev": true "dev": true
}, },
"env-paths": {
"version": "1.0.0",
"resolved": "https://nexus.loafle.net/repository/npm-all/env-paths/-/env-paths-1.0.0.tgz",
"integrity": "sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA=",
"dev": true
},
"err-code": { "err-code": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://nexus.loafle.net/repository/npm-all/err-code/-/err-code-1.1.2.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/err-code/-/err-code-1.1.2.tgz",
@ -3656,6 +3744,18 @@
} }
} }
}, },
"extract-zip": {
"version": "1.6.7",
"resolved": "https://nexus.loafle.net/repository/npm-all/extract-zip/-/extract-zip-1.6.7.tgz",
"integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=",
"dev": true,
"requires": {
"concat-stream": "1.6.2",
"debug": "2.6.9",
"mkdirp": "0.5.1",
"yauzl": "2.4.1"
}
},
"extsprintf": { "extsprintf": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://nexus.loafle.net/repository/npm-all/extsprintf/-/extsprintf-1.3.0.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/extsprintf/-/extsprintf-1.3.0.tgz",
@ -3689,6 +3789,15 @@
"websocket-driver": ">=0.5.1" "websocket-driver": ">=0.5.1"
} }
}, },
"fd-slicer": {
"version": "1.0.1",
"resolved": "https://nexus.loafle.net/repository/npm-all/fd-slicer/-/fd-slicer-1.0.1.tgz",
"integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=",
"dev": true,
"requires": {
"pend": "~1.2.0"
}
},
"figgy-pudding": { "figgy-pudding": {
"version": "3.5.1", "version": "3.5.1",
"resolved": "https://nexus.loafle.net/repository/npm-all/figgy-pudding/-/figgy-pudding-3.5.1.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/figgy-pudding/-/figgy-pudding-3.5.1.tgz",
@ -7363,6 +7472,21 @@
"set-blocking": "~2.0.0" "set-blocking": "~2.0.0"
} }
}, },
"nugget": {
"version": "2.0.1",
"resolved": "https://nexus.loafle.net/repository/npm-all/nugget/-/nugget-2.0.1.tgz",
"integrity": "sha1-IBCVpIfhrTYIGzQy+jytpPjQcbA=",
"dev": true,
"requires": {
"debug": "^2.1.3",
"minimist": "^1.1.0",
"pretty-bytes": "^1.0.2",
"progress-stream": "^1.1.0",
"request": "^2.45.0",
"single-line-log": "^1.1.2",
"throttleit": "0.0.2"
}
},
"null-check": { "null-check": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://nexus.loafle.net/repository/npm-all/null-check/-/null-check-1.0.0.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/null-check/-/null-check-1.0.0.tgz",
@ -7930,6 +8054,12 @@
"sha.js": "^2.4.8" "sha.js": "^2.4.8"
} }
}, },
"pend": {
"version": "1.2.0",
"resolved": "https://nexus.loafle.net/repository/npm-all/pend/-/pend-1.2.0.tgz",
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
"dev": true
},
"performance-now": { "performance-now": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://nexus.loafle.net/repository/npm-all/performance-now/-/performance-now-2.1.0.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/performance-now/-/performance-now-2.1.0.tgz",
@ -8083,6 +8213,16 @@
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=",
"dev": true "dev": true
}, },
"pretty-bytes": {
"version": "1.0.4",
"resolved": "https://nexus.loafle.net/repository/npm-all/pretty-bytes/-/pretty-bytes-1.0.4.tgz",
"integrity": "sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ=",
"dev": true,
"requires": {
"get-stdin": "^4.0.1",
"meow": "^3.1.0"
}
},
"process": { "process": {
"version": "0.11.10", "version": "0.11.10",
"resolved": "https://nexus.loafle.net/repository/npm-all/process/-/process-0.11.10.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/process/-/process-0.11.10.tgz",
@ -8095,6 +8235,67 @@
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
"dev": true "dev": true
}, },
"progress-stream": {
"version": "1.2.0",
"resolved": "https://nexus.loafle.net/repository/npm-all/progress-stream/-/progress-stream-1.2.0.tgz",
"integrity": "sha1-LNPP6jO6OonJwSHsM0er6asSX3c=",
"dev": true,
"requires": {
"speedometer": "~0.1.2",
"through2": "~0.2.3"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://nexus.loafle.net/repository/npm-all/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
"dev": true
},
"object-keys": {
"version": "0.4.0",
"resolved": "https://nexus.loafle.net/repository/npm-all/object-keys/-/object-keys-0.4.0.tgz",
"integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=",
"dev": true
},
"readable-stream": {
"version": "1.1.14",
"resolved": "https://nexus.loafle.net/repository/npm-all/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"dev": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://nexus.loafle.net/repository/npm-all/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"dev": true
},
"through2": {
"version": "0.2.3",
"resolved": "https://nexus.loafle.net/repository/npm-all/through2/-/through2-0.2.3.tgz",
"integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=",
"dev": true,
"requires": {
"readable-stream": "~1.1.9",
"xtend": "~2.1.1"
}
},
"xtend": {
"version": "2.1.2",
"resolved": "https://nexus.loafle.net/repository/npm-all/xtend/-/xtend-2.1.2.tgz",
"integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=",
"dev": true,
"requires": {
"object-keys": "~0.4.0"
}
}
}
},
"promise": { "promise": {
"version": "7.3.1", "version": "7.3.1",
"resolved": "https://nexus.loafle.net/repository/npm-all/promise/-/promise-7.3.1.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/promise/-/promise-7.3.1.tgz",
@ -9208,6 +9409,15 @@
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"dev": true "dev": true
}, },
"single-line-log": {
"version": "1.1.2",
"resolved": "https://nexus.loafle.net/repository/npm-all/single-line-log/-/single-line-log-1.1.2.tgz",
"integrity": "sha1-wvg/Jzo+GhbtsJlWYdoO1e8DM2Q=",
"dev": true,
"requires": {
"string-width": "^1.0.1"
}
},
"slash": { "slash": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://nexus.loafle.net/repository/npm-all/slash/-/slash-1.0.0.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/slash/-/slash-1.0.0.tgz",
@ -9685,6 +9895,12 @@
"chalk": "^2.0.1" "chalk": "^2.0.1"
} }
}, },
"speedometer": {
"version": "0.1.4",
"resolved": "https://nexus.loafle.net/repository/npm-all/speedometer/-/speedometer-0.1.4.tgz",
"integrity": "sha1-mHbb0qFp0xFUAtSObqYynIgWpQ0=",
"dev": true
},
"split-string": { "split-string": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://nexus.loafle.net/repository/npm-all/split-string/-/split-string-3.1.0.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/split-string/-/split-string-3.1.0.tgz",
@ -9970,6 +10186,15 @@
"when": "~3.6.x" "when": "~3.6.x"
} }
}, },
"sumchecker": {
"version": "2.0.2",
"resolved": "https://nexus.loafle.net/repository/npm-all/sumchecker/-/sumchecker-2.0.2.tgz",
"integrity": "sha1-D0LBDl0F2l1C7qPlbDOZo31sWz4=",
"dev": true,
"requires": {
"debug": "^2.2.0"
}
},
"supports-color": { "supports-color": {
"version": "6.1.0", "version": "6.1.0",
"resolved": "https://nexus.loafle.net/repository/npm-all/supports-color/-/supports-color-6.1.0.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/supports-color/-/supports-color-6.1.0.tgz",
@ -10235,6 +10460,12 @@
} }
} }
}, },
"throttleit": {
"version": "0.0.2",
"resolved": "https://nexus.loafle.net/repository/npm-all/throttleit/-/throttleit-0.0.2.tgz",
"integrity": "sha1-z+34jmDADdlpe2H90qg0OptoDq8=",
"dev": true
},
"through": { "through": {
"version": "2.3.8", "version": "2.3.8",
"resolved": "https://nexus.loafle.net/repository/npm-all/through/-/through-2.3.8.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/through/-/through-2.3.8.tgz",
@ -11544,6 +11775,15 @@
} }
} }
}, },
"yauzl": {
"version": "2.4.1",
"resolved": "https://nexus.loafle.net/repository/npm-all/yauzl/-/yauzl-2.4.1.tgz",
"integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=",
"dev": true,
"requires": {
"fd-slicer": "~1.0.1"
}
},
"yeast": { "yeast": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://nexus.loafle.net/repository/npm-all/yeast/-/yeast-0.1.2.tgz", "resolved": "https://nexus.loafle.net/repository/npm-all/yeast/-/yeast-0.1.2.tgz",

View File

@ -46,17 +46,20 @@
"zone.js": "~0.8.26" "zone.js": "~0.8.26"
}, },
"devDependencies": { "devDependencies": {
"@angular-builders/custom-webpack": "^7.4.3",
"@angular-devkit/build-angular": "~0.13.0", "@angular-devkit/build-angular": "~0.13.0",
"@angular-devkit/build-ng-packagr": "~0.13.0", "@angular-devkit/build-ng-packagr": "~0.13.0",
"@angular/cli": "~7.3.8", "@angular/cli": "~7.3.8",
"@angular/compiler-cli": "~7.2.0", "@angular/compiler-cli": "~7.2.0",
"@angular/language-service": "~7.2.0", "@angular/language-service": "~7.2.0",
"@types/electron": "^1.6.10",
"@types/hammerjs": "^2.0.36", "@types/hammerjs": "^2.0.36",
"@types/node": "~8.9.4", "@types/node": "~8.9.4",
"@types/jasmine": "~2.8.8", "@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3", "@types/jasminewd2": "~2.0.3",
"codelyzer": "~4.5.0", "codelyzer": "~4.5.0",
"cross-env": "^5.2.0", "cross-env": "^5.2.0",
"electron": "^5.0.1",
"jasmine-core": "~2.99.1", "jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1", "jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.0", "karma": "~4.0.0",

View File

@ -0,0 +1,4 @@
module.exports = {
// node: { crypto: true, stream: true, fs: 'empty', net: 'empty' }
target: 'electron-renderer'
};

View File

@ -1,5 +1,7 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ElectronProxyService } from '@odds-crawler/electron-proxy';
@Component({ @Component({
selector: 'odds-crawler-app-page-main', selector: 'odds-crawler-app-page-main',
templateUrl: './main.page.component.html', templateUrl: './main.page.component.html',
@ -10,9 +12,13 @@ export class MainPageComponent {
tabSelectedIndex: 0; tabSelectedIndex: 0;
lnbSideNavOpened = true; lnbSideNavOpened = true;
constructor(private electronProxyService: ElectronProxyService) {}
onClickNewTab(tabURL: HTMLInputElement) { onClickNewTab(tabURL: HTMLInputElement) {
this.addTab('new' + tabURL.value); this.addTab('new' + tabURL.value);
console.log(`new: ${tabURL.value}`); console.log(`new: ${this.electronProxyService.isElectronApp}`);
this.electronProxyService.ipcRenderer.send('pong');
} }
onTabSelectedIndexChange($event) {} onTabSelectedIndexChange($event) {}

View File

@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { OddsCrawlerFrontendCommonModule } from '@odds-crawler/common'; import { OddsCrawlerFrontendCommonModule } from '@odds-crawler/common';
import { OddsCrawlerFrontendElectronProxyModule } from '@odds-crawler/electron-proxy';
import { OddsCrawlerFrontendPageModule } from '@odds-crawler/page'; import { OddsCrawlerFrontendPageModule } from '@odds-crawler/page';
import { OddsCrawlerFrontendNetworkModule } from '@odds-crawler/network'; import { OddsCrawlerFrontendNetworkModule } from '@odds-crawler/network';
@ -12,6 +13,7 @@ import { MainRoutingPageModule } from './main-routing.page.module';
imports: [ imports: [
CommonModule, CommonModule,
OddsCrawlerFrontendCommonModule, OddsCrawlerFrontendCommonModule,
OddsCrawlerFrontendElectronProxyModule,
OddsCrawlerFrontendPageModule, OddsCrawlerFrontendPageModule,
OddsCrawlerFrontendNetworkModule, OddsCrawlerFrontendNetworkModule,
MainRoutingPageModule MainRoutingPageModule

View File

@ -4,8 +4,5 @@
"outDir": "../../out-tsc/app", "outDir": "../../out-tsc/app",
"types": [] "types": []
}, },
"exclude": [ "exclude": ["test.ts", "**/*.spec.ts"]
"test.ts",
"**/*.spec.ts"
]
} }

View File

@ -1,8 +1,12 @@
{ {
"name": "@odds-crawler/electron-proxy", "name": "@odds-crawler/electron-proxy",
"version": "0.0.1", "version": "0.0.1",
"dependencies": {},
"devDependencies": {},
"peerDependencies": { "peerDependencies": {
"@angular/common": "^7.2.0", "@angular/common": "^7.2.0",
"@angular/core": "^7.2.0" "@angular/core": "^7.2.0",
"@types/electron": "^1.6.10",
"electron": "^5.0.1"
} }
} }

View File

@ -1,16 +1,14 @@
import { NgModule, ModuleWithProviders } from '@angular/core'; import { NgModule, ModuleWithProviders } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { OddsCrawlerFrontendCommonModule } from '@odds-crawler/common'; import { ElectronProxyService } from './service/electron-proxy.service';
import { IpcService } from './service/ipc.service';
export const COMPONENTS = []; export const COMPONENTS = [];
export const SERVICES = [IpcService]; export const SERVICES = [ElectronProxyService];
@NgModule({ @NgModule({
declarations: [...COMPONENTS], declarations: [...COMPONENTS],
imports: [CommonModule, OddsCrawlerFrontendCommonModule], imports: [CommonModule],
exports: [...COMPONENTS] exports: [...COMPONENTS]
}) })
export class OddsCrawlerFrontendElectronProxyModule { export class OddsCrawlerFrontendElectronProxyModule {

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { ElectronProxyService } from './electron-proxy.service';
describe('electron.ElectronProxyService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: ElectronProxyService = TestBed.get(ElectronProxyService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,77 @@
import { Injectable } from '@angular/core';
import * as Electron from 'electron';
@Injectable({
providedIn: 'root'
})
export class ElectronProxyService {
constructor() {}
/**
* determines if SPA is running in Electron
*/
public get isElectronApp(): boolean {
return !!window.navigator.userAgent.match(/Electron/);
}
public get isMacOS(): boolean {
return this.isElectronApp && process.platform === 'darwin';
}
public get isWindows(): boolean {
return this.isElectronApp && process.platform === 'win32';
}
public get isLinux(): boolean {
return this.isElectronApp && process.platform === 'linux';
}
public get isX86(): boolean {
return this.isElectronApp && process.arch === 'ia32';
}
public get isX64(): boolean {
return this.isElectronApp && process.arch === 'x64';
}
public get ipcRenderer(): Electron.IpcRenderer {
return Electron.ipcRenderer;
}
// public get desktopCapturer(): Electron.DesktopCapturer {
// return Electron.desktopCapturer;
// }
// public get remote(): Electron.Remote {
// return Electron.remote;
// }
// public get webFrame(): Electron.WebFrame {
// return Electron.webFrame;
// }
// public get clipboard(): Electron.Clipboard {
// return Electron.clipboard;
// }
// public get crashReporter(): Electron.CrashReporter {
// return Electron.crashReporter;
// }
// public get process(): any {
// return this.remote ? this.remote.process : null;
// }
// public get nativeImage(): typeof Electron.nativeImage {
// return Electron.nativeImage;
// }
// public get screen(): Electron.Screen {
// return Electron.screen;
// }
// public get shell(): Electron.Shell {
// return Electron.shell;
// }
}

View File

@ -1,12 +0,0 @@
import { TestBed } from '@angular/core/testing';
import { IpcService } from './ipc.service';
describe('electron.IpcService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: IpcService = TestBed.get(IpcService);
expect(service).toBeTruthy();
});
});

View File

@ -1,8 +0,0 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class IpcService {
constructor() {}
}

View File

@ -4,4 +4,4 @@
export * from './lib/electron-proxy.module'; export * from './lib/electron-proxy.module';
export * from './lib/service/ipc.service'; export * from './lib/service/electron-proxy.service';

View File

@ -0,0 +1,3 @@
interface Window {
require: NodeRequire;
}

View File

@ -11,11 +11,9 @@
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"importHelpers": true, "importHelpers": true,
"typeRoots": ["node_modules/@types", "src/types"],
"types": [], "types": [],
"lib": [ "lib": ["dom", "es2018"]
"dom",
"es2018"
]
}, },
"angularCompilerOptions": { "angularCompilerOptions": {
"annotateForClosureCompiler": true, "annotateForClosureCompiler": true,
@ -25,8 +23,5 @@
"strictInjectionParameters": true, "strictInjectionParameters": true,
"enableResourceInlining": true "enableResourceInlining": true
}, },
"exclude": [ "exclude": ["src/test.ts", "**/*.spec.ts"]
"src/test.ts",
"**/*.spec.ts"
]
} }

View File

@ -5,13 +5,14 @@
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
"sourceMap": true, "sourceMap": true,
"declaration": false, "declaration": false,
"module": "es2015", "module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"importHelpers": true, "importHelpers": true,
"target": "es5", "target": "es5",
"typeRoots": ["node_modules/@types"], "typeRoots": ["node_modules/@types"],
"types": ["node", "reflect-metadata"],
"lib": ["es2018", "dom"], "lib": ["es2018", "dom"],
"paths": { "paths": {
"@odds-crawler/common": ["dist/odds-crawler-frontend-common"], "@odds-crawler/common": ["dist/odds-crawler-frontend-common"],