You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| .NET 4.5 | Windows |`edge-fs`|`fs`|[Script F# in Node.js](https://github.com/agracio/edge-fs):link:|
196
+
| CoreCLR | Windows |`edge-fs`|`fs`|[Script F# in Node.js](https://github.com/agracio/edge-fs):link:|
194
197
195
198
---------
196
199
197
200
## How to use
198
201
199
-
####[Scripting CLR from Node.js](#scripting-clr-from-nodejs) - full documentation
200
-
####[Scripting Node.js from CLR](#how-to-integrate-nodejs-code-into-clr-code) - full documentation
202
+
### [Scripting CLR from Node.js](#scripting-clr-from-nodejs) - full documentation
203
+
### [Scripting Node.js from CLR](#how-to-integrate-nodejs-code-into-clr-code) - full documentation
201
204
202
-
####Scripting CLR from Node.js sample app https://github.com/agracio/edge-js-quick-start
205
+
### Scripting CLR from Node.js sample app https://github.com/agracio/edge-js-quick-start
203
206
----
204
207
205
-
### Scripting CLR from Node.js examples
208
+
### Short guide
209
+
210
+
-[Inline C# code](#inline-c-code)
211
+
-[Passing parameters](#passing-parameters)
212
+
-[Using C# class](#using-c-class)
213
+
-[Using compiled dll](#using-compiled-assembly)
214
+
-[Using CoreCLR](#coreclr)
215
+
-[Executing synchronously without function callback](#executing-synchronously-without-function-callback)
216
+
-[Using promises/async](#promises)
217
+
-[Scripting Node.js from CLR](#scripting-nodejs-from-clr)
218
+
-[Docker](#docker)
206
219
207
220
### Inline C# code
208
221
@@ -240,32 +253,6 @@ helloWorld('JavaScript', function (error, result) {
240
253
});
241
254
```
242
255
243
-
#### CoreCLR
244
-
* If not set Edge.js will run as .NET 4.5 on Windows and as Mono on macOS/Linux
245
-
* Can be set using `js` code below or as an environment variable `SET EDGE_USE_CORECLR=1`
246
-
* Check [appveyor.yml](https://github.com/agracio/edge-js/blob/master/appveyor.yml)`test_script` for reference on setting env variables
247
-
* Must be set before `var edge = require('edge-js');`
248
-
249
-
```js
250
-
// set this variable before
251
-
// var edge = require('edge-js');
252
-
253
-
process.env.EDGE_USE_CORECLR=1
254
-
255
-
var edge =require('edge-js');
256
-
257
-
var helloWorld =edge.func(function () {/*
258
-
async (input) => {
259
-
return ".NET Welcomes " + input.ToString();
260
-
}
261
-
*/});
262
-
263
-
helloWorld('JavaScript', function (error, result) {
264
-
if (error) throw error;
265
-
console.log(result);
266
-
});
267
-
```
268
-
269
256
### Passing parameters
270
257
271
258
```js
@@ -382,7 +369,7 @@ namespace EdgeJsMethods
382
369
var edge =require('edge-js');
383
370
384
371
var getPerson =edge.func({
385
-
assemblyFile: myDll, // path to .dll
372
+
assemblyFile: myDll, // path to compiled .dll
386
373
typeName:'EdgeJsMethods.Methods',
387
374
methodName:'GetPerson'
388
375
});
@@ -403,6 +390,31 @@ public async Task<object> MyMethod(object|dynamic input)
403
390
}
404
391
```
405
392
393
+
#### CoreCLR
394
+
* If not set Edge.js will run as .NET 4.5 on Windows and as Mono on macOS/Linux
395
+
* Can be set using `js` code below or as an environment variable `SET EDGE_USE_CORECLR=1` or `EXPORT EDGE_USE_CORECLR=1` depending on your platform.
396
+
* Must be set before `var edge = require('edge-js');`
397
+
398
+
```js
399
+
// set this variable before
400
+
// var edge = require('edge-js');
401
+
402
+
process.env.EDGE_USE_CORECLR=1
403
+
404
+
var edge =require('edge-js');
405
+
406
+
var helloWorld =edge.func(function () {/*
407
+
async (input) => {
408
+
return ".NET Welcomes " + input.ToString();
409
+
}
410
+
*/});
411
+
412
+
helloWorld('JavaScript', function (error, result) {
413
+
if (error) throw error;
414
+
console.log(result);
415
+
});
416
+
```
417
+
406
418
### Executing synchronously without function callback
407
419
408
420
If your C# implementation will complete synchronously you can call this function as any synchronous JavaScript function as follows:
@@ -432,10 +444,31 @@ var helloWorld = edge.func(function () {/*
0 commit comments