Comparing version 0.7.13 to 0.7.14
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "0.7.13", | ||
"version": "0.7.14", | ||
"description": "Edge.js: run .NET and node.js code in-process", | ||
@@ -11,0 +11,0 @@ "tags": [ |
@@ -483,3 +483,3 @@ Edge.js: run .NET and Node.js code in-process | ||
Your Python script must evaluate to a lamda expression that accepts a single parameter. The parameter represents marshalled input from the node.js code. The return value of the lambda expression is passed back as the result to node.js code. The Python script can contain constructs (e.g. Python functions) that are used in the closure of the lambda expression. The instance of the script with associated state is created when `edge.func` is called in node.js. Each call to the function referes to that instance. | ||
Your Python script must evaluate to a lambda expression that accepts a single parameter. The parameter represents marshalled input from the node.js code. The return value of the lambda expression is passed back as the result to node.js code. The Python script can contain constructs (e.g. Python functions) that are used in the closure of the lambda expression. The instance of the script with associated state is created when `edge.func` is called in node.js. Each call to the function referes to that instance. | ||
@@ -486,0 +486,0 @@ The simplest *echo* Python script you can embed in node.js looks like this: |
@@ -8,7 +8,6 @@ // Overview of edge.js: http://tjanczuk.github.com/edge | ||
async (data) => | ||
async (dynamic data) => | ||
{ | ||
var input = (IDictionary<string,object>)data; | ||
int sum = (int)(input["a"]) + (int)(input["b"]); | ||
var multiplyBy2 = (Func<object,Task<object>>)input["multiplyBy2"]; | ||
int sum = (int)data.a + (int)data.b; | ||
var multiplyBy2 = (Func<object,Task<object>>)data.multiplyBy2; | ||
return await multiplyBy2(sum); | ||
@@ -15,0 +14,0 @@ } |
@@ -11,8 +11,7 @@ // Overview of edge.js: http://tjanczuk.github.com/edge | ||
async (data) => | ||
async (dynamic data) => | ||
{ | ||
var input = (IDictionary<string,object>)data; | ||
X509Store store = new X509Store( | ||
(string)input["storeName"], | ||
(StoreLocation)Enum.Parse(typeof(StoreLocation), (string)input["storeLocation"])); | ||
(string)data.storeName, | ||
(StoreLocation)Enum.Parse(typeof(StoreLocation), (string)data.storeLocation)); | ||
store.Open(OpenFlags.ReadOnly); | ||
@@ -36,3 +35,3 @@ try | ||
var result = listCertificates({ storeName: 'My', storeLocation: 'CurrentUser' }, true); | ||
var result = listCertificates({ storeName: 'My', storeLocation: 'LocalMachine' }, true); | ||
console.log(result); |
@@ -9,7 +9,6 @@ // Overview of edge.js: http://tjanczuk.github.com/edge | ||
async (input) => | ||
async (dynamic parameters) => | ||
{ | ||
var parameters = (IDictionary<string,object>)input; | ||
var source = (string)parameters["source"]; | ||
var log = (string)parameters["log"]; | ||
var source = (string)parameters.source; | ||
var log = (string)parameters.log; | ||
if (!EventLog.SourceExists(source)) | ||
@@ -22,6 +21,6 @@ { | ||
source, | ||
(string)parameters["message"], | ||
(string)parameters.message, | ||
(EventLogEntryType)Enum.Parse( | ||
typeof(EventLogEntryType), (string)parameters["type"]), | ||
(int)parameters["id"] | ||
typeof(EventLogEntryType), (string)parameters.type), | ||
(int)parameters.id | ||
); | ||
@@ -28,0 +27,0 @@ |
var edge = require('../lib/edge'); | ||
var readRegistery = edge.func(function () {/* | ||
using System.Collections.Generic; | ||
using Microsoft.Win32; | ||
using Microsoft.Win32; | ||
async (data) => | ||
{ | ||
var input = (IDictionary<string,object>)data; | ||
var keyName = (string) input["keyName"]; | ||
var valueName = (string) input["valueName"]; | ||
var defaultValue = (string) null; | ||
if (input.ContainsKey("defaultValue")) | ||
{ | ||
defaultValue = (string) input["defaultValue"]; | ||
} | ||
async (dynamic input) => | ||
{ | ||
return Registry.GetValue((string) input.keyName, (string) input.valueName, null); | ||
} | ||
*/}); | ||
var readValue = Registry.GetValue(keyName, valueName, defaultValue); | ||
return readValue; | ||
} | ||
*/} | ||
); | ||
readRegistery({keyName: 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\4.0', valueName: 'MSBuildOverrideTasksPath'}, function (err, result) { | ||
readRegistery({ | ||
keyName: 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\4.0', | ||
valueName: 'MSBuildOverrideTasksPath' | ||
}, function (err, result) { | ||
if (err) { | ||
throw new Error(err); | ||
throw err; | ||
} | ||
@@ -29,0 +19,0 @@ |
var edge = require('../lib/edge'); | ||
var writeRegistery = edge.func(function () {/* | ||
using System.Collections.Generic; | ||
using Microsoft.Win32; | ||
using Microsoft.Win32; | ||
async (data) => | ||
{ | ||
var input = (IDictionary<string,object>)data; | ||
var keyName = (string)input["keyName"]; | ||
var valueName = (string)input["valueName"]; | ||
var value = input["value"]; | ||
async (dynamic input) => | ||
{ | ||
Registry.SetValue((string)input.keyName, (string)input.valueName, input.value); | ||
return null; | ||
} | ||
*/}); | ||
Registry.SetValue(keyName, valueName, value); | ||
return null; | ||
} | ||
*/} | ||
); | ||
writeRegistery({keyName: 'HKEY_CURRENT_USER\\Environment', valueName: 'MyCustomValue', value: 1050 }, function (err) { | ||
writeRegistery({ | ||
keyName: 'HKEY_CURRENT_USER\\Environment', | ||
valueName: 'MyCustomValue', | ||
value: 1050 | ||
}, function (err) { | ||
if (err) { | ||
throw new Error(err); | ||
throw err; | ||
} | ||
@@ -25,0 +21,0 @@ |
@@ -8,10 +8,8 @@ // Overview of edge.js: http://tjanczuk.github.com/edge | ||
using System.Collections.Generic; | ||
using System.IO.Compression; | ||
async (data) => | ||
async (dynamic input) => | ||
{ | ||
var input = (IDictionary<string,object>)data; | ||
await Task.Run(async () => { | ||
ZipFile.ExtractToDirectory((string)input["source"], (string)input["destination"]); | ||
ZipFile.ExtractToDirectory((string)input.source, (string)input.destination); | ||
}); | ||
@@ -18,0 +16,0 @@ |
@@ -8,10 +8,8 @@ // Overview of edge.js: http://tjanczuk.github.com/edge | ||
using System.Collections.Generic; | ||
using System.IO.Compression; | ||
async (data) => | ||
async (dynamic input) => | ||
{ | ||
var input = (IDictionary<string,object>)data; | ||
await Task.Run(async () => { | ||
ZipFile.CreateFromDirectory((string)input["source"], (string)input["destination"]); | ||
ZipFile.CreateFromDirectory((string)input.source, (string)input.destination); | ||
}); | ||
@@ -18,0 +16,0 @@ |
@@ -107,2 +107,32 @@ var edge = require('../lib/edge.js'), assert = require('assert'); | ||
}); | ||
it('successfuly roundtrips unicode characters', function (done) { | ||
var func = edge.func(function () {/* | ||
async (input) => { | ||
return input; | ||
} | ||
*/}); | ||
var k = "ñòóôõöøùúûüýÿ"; | ||
func(k, function (error, result) { | ||
assert.ifError(error); | ||
assert.ok(result === k); | ||
done(); | ||
}) | ||
}); | ||
it('successfuly roundtrips empty string', function (done) { | ||
var func = edge.func(function () {/* | ||
async (input) => { | ||
return input; | ||
} | ||
*/}); | ||
var k = ""; | ||
func(k, function (error, result) { | ||
assert.ifError(error); | ||
assert.ok(result === k); | ||
done(); | ||
}) | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2547368
2073