35.0.0 • Published 6 months ago

electron-edge-js v35.0.0

Weekly downloads
492
License
MIT
Repository
github
Last release
6 months ago

.NET and Node.js in-process on Electron

Actions Status Git Issues Closed Issues

This is a fork of edge-js adapted to support Electron

Windows binaries pre-compiled for

Electronx86/x64arm64
Electron 29.x:heavy_check_mark::heavy_check_mark:
Electron 30.x:heavy_check_mark::heavy_check_mark:
Electron 31.x:heavy_check_mark::heavy_check_mark:
Electron 32.x:heavy_check_mark::heavy_check_mark:
Electron 33.x:heavy_check_mark::heavy_check_mark:
Electron 34.x:heavy_check_mark::heavy_check_mark:
Electron 35.x:heavy_check_mark::heavy_check_mark:

On Linux and macOS npm install will compile binaries with correct Electron headers for a given Electron version.

Linux/macOS suppoted versions

Electronx64arm64
Electron 29 - 35:heavy_check_mark::heavy_check_mark:

Usage is the same as edge-js, replace require('edge-js') with require('electron-edge-js'):

npm install electron-edge-js
-var edge = require('edge-js');
+var edge = require('electron-edge-js');

var helloWorld = edge.func(function () {/*
    async (input) => {
        return ".NET Welcomes " + input.ToString();
    }
*/});

Quick start

Sample app that shows how to work with .NET Core using inline code and compiled C# libraries.
https://github.com/agracio/electron-edge-js-quick-start

Pre-requisites

Packaging Electron application

electron-edge-js needs to be specified as an external module, some examples

webpack

webpack.config.js

externals: {
    'electron-edge-js': 'commonjs2 electron-edge-js',
},
node: {
    __dirname: true,
    __filename: true,
},

From #138

webpack.config.js

externals: {
    'electron-edge-js': 'commonjs2 electron-edge-js',
},
node: {
    __dirname: false,
    __filename: false,
},
extraResources:[
    "./node_modules/electron-edge-js/**",
]

Electron main.js

// https://github.com/ScottJMarshall/electron-webpack-module-resolution
require("module").globalPaths.push(process.cwd()+'/node_modules');
var edge = require('electron-edge-js');

Vue.js

vue.config.js

module.export = {
    pluginOptions: {
        electronBuilder: {
            externals:["electron-edge-js"]
        }
    }
}

Related issues to use for troubleshooting:
https://github.com/agracio/electron-edge-js/issues/39
https://github.com/agracio/electron-edge-js/issues/74
https://github.com/agracio/electron-edge-js/issues/21
https://github.com/agracio/electron-edge-js/issues/138

electron-builder

electron-edge-js should be excluded from rebuild.

electron-forge

electron-forge example based on electron-edge-js-quick-start
https://github.com/agracio/electron-edge-js-quick-start-forge

Async execution

If electron-edge-js module is used on main Electron thread it will cause Electron app to freeze when executing long-running .NET code even if your C# code is fully async.
To avoid this you can use worker thread packages such as threads.js or piscina

This issue is not present when using Electron IPC

Workaround from #97

main.js

const { fork } = require("child_process"); fork("../child.js", [], { env: {file: 'filename'}, })

child.js

const path = require('path');
const powerpoint = require('office-script').powerpoint;
const filePath = '../../directory/';

powerpoint.open(path.join(${remotePath}${process.env.file}.pptx), function(err) {
    if(err) throw err;
});

Window refresh issue

If electron-edge-js module is used on main Electron thread refreshing the window (F5, Ctrl+R, Command+R etc) will cause a hard crash in electron-edge-js module and Electron app.
Currently there is no solution to this issue other than using Electron IPC.

Documentation

For full documentation see edge-js repo.

35.0.0

6 months ago

34.0.0

8 months ago

33.0.4

9 months ago

33.0.5

9 months ago

33.0.3

10 months ago

33.0.2

10 months ago

33.0.1

10 months ago

33.0.0

11 months ago

32.0.1

11 months ago

31.3.1

12 months ago

32.0.0

11 months ago

31.3.0

1 year ago

31.1.0

1 year ago

31.0.0

1 year ago

30.1.2

1 year ago

30.1.0

1 year ago

30.1.1

1 year ago

30.0.2

1 year ago

30.0.1

1 year ago

30.0.0

1 year ago

29.0.2

1 year ago

29.0.1

1 year ago

29.0.0

1 year ago

28.0.1

2 years ago

28.0.0

2 years ago

26.0.0

2 years ago

23.0.0

2 years ago

22.0.1

3 years ago

22.0.0

3 years ago

19.0.0

3 years ago

18.0.1

3 years ago

18.0.0

3 years ago

17.0.0

3 years ago

14.16.1

4 years ago

14.16.0

4 years ago

12.18.5

5 years ago

12.18.4

5 years ago

12.18.3

5 years ago

12.16.3

5 years ago

12.14.2

5 years ago

12.14.1

5 years ago

12.13.0

6 years ago

12.8.1

6 years ago

12.4.1

6 years ago

12.4.0

6 years ago

12.0.1

6 years ago

12.0.0

6 years ago

10.11.1

7 years ago

10.11.0

7 years ago

8.3.8

7 years ago

8.3.7

7 years ago

8.3.6

7 years ago

8.3.5

7 years ago

8.3.4

7 years ago

8.3.3

7 years ago

8.3.2

8 years ago

8.3.1

8 years ago

8.3.0

8 years ago

8.2.9

8 years ago

8.2.8

8 years ago

8.2.7

8 years ago

8.2.6

8 years ago

8.2.5

8 years ago

8.2.4

8 years ago

8.2.3

8 years ago

8.2.2

8 years ago