A small test environment with a javascript engine, and javascript commands implemented in dotnet using a simple plugin framework.
- Dotnet project that executes simple JavaScript files.
- New commands for JS are implemented in c# using a simple plugin framework.
- Project purpose is to explore reflection and source code generation.
-
Create a plugin by extending the
IJSOperationinterface. -
Create a JS script in the scripts folder.
-
Run and enter the name of your script when the system promts for it.
That's it! If you did everything correctly the system will execute your script.
-
The
Executemethod does not return any value, but a return value can be defined by adding theOutputattribute to a property, and assigning to this property before returning from theExecutemethod. -
Input parameters can be defined by tagging properties with the
Inputproperty. These properties will be set by the framework before running theExecutemethod. -
The
Nameproperty determines the name of the function that is visible from JS. -
Plugins must be defined using the
partialkeyword. -
You can use
console.login your script to print output to the screen.
- Refactor the source generator
- Add support for non-primitive types