forked from agracio/electron-edge-js-quick-start
-
Notifications
You must be signed in to change notification settings - Fork 0
/
renderer.js
66 lines (50 loc) · 1.82 KB
/
renderer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const path = require('path');
var version = location.search.split('version=')[1];
var namespace = 'QuickStart.' + version.charAt(0).toUpperCase() + version.substr(1);
if(version === 'core') version = 'coreapp';
const baseNetAppPath = path.join(__dirname, '/src/'+ namespace +'/bin/Debug/net'+ version +'2.0');
process.env.EDGE_USE_CORECLR = 1;
if(version !== 'standard')
process.env.EDGE_APP_ROOT = baseNetAppPath;
var edge = require('electron-edge-js');
var baseDll = path.join(baseNetAppPath, namespace + '.dll');
var localTypeName = namespace + '.LocalMethods';
var externalTypeName = namespace + '.ExternalMethods';
var getAppDomainDirectory = edge.func({
assemblyFile: baseDll,
typeName: localTypeName,
methodName: 'GetAppDomainDirectory'
});
var getCurrentTime = edge.func({
assemblyFile: baseDll,
typeName: localTypeName,
methodName: 'GetCurrentTime'
});
var useDynamicInput = edge.func({
assemblyFile: baseDll,
typeName: localTypeName,
methodName: 'UseDynamicInput'
});
var getPerson = edge.func({
assemblyFile: baseDll,
typeName: externalTypeName,
methodName: 'GetPersonInfo'
});
window.onload = function() {
getAppDomainDirectory('', function(error, result) {
if (error) throw error;
document.getElementById("GetAppDomainDirectory").innerHTML = result;
});
getCurrentTime('', function(error, result) {
if (error) throw error;
document.getElementById("GetCurrentTime").innerHTML = result;
});
useDynamicInput('Node.Js', function(error, result) {
if (error) throw error;
document.getElementById("UseDynamicInput").innerHTML = result;
});
getPerson('', function(error, result) {
//if (error) throw JSON.stringify(error);
document.getElementById("GetPersonInfo").innerHTML = result;
});
};