[add] first
This commit is contained in:
30
assets/scripts/core/app/Electron.ts
Normal file
30
assets/scripts/core/app/Electron.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
export default class Electron {
|
||||
|
||||
static is_steam = false;
|
||||
|
||||
static counter = 0;
|
||||
|
||||
static get appUserID () {
|
||||
return globalThis.remote ? globalThis.remote.app.getUserID() : '';
|
||||
}
|
||||
|
||||
static get appUserPath () {
|
||||
return globalThis.remote ? globalThis.remote.app.getPath('userData') : '';
|
||||
}
|
||||
|
||||
static async sendAsync (name: string, data: any = undefined, call: Function = undefined) {
|
||||
var call_data = await (window as any).electron?.ipcRenderer.invoke(name, data);
|
||||
if (call !== undefined) {
|
||||
call(call_data);
|
||||
}
|
||||
}
|
||||
|
||||
static send (name: string, data: any = undefined) {
|
||||
var call_data = (window as any).electron?.ipcRenderer.invoke(name, data);
|
||||
return call_data;
|
||||
}
|
||||
|
||||
static A2C (name: string, data: any): void {
|
||||
console.log('A2C:', name, data);
|
||||
}
|
||||
}
|
||||
9
assets/scripts/core/app/Electron.ts.meta
Normal file
9
assets/scripts/core/app/Electron.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "0907ef0b-4f44-48da-bb40-6d0db388014c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user