Skip to content

Instantly share code, notes, and snippets.

@kevinswiber
Created August 10, 2011 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinswiber/1135641 to your computer and use it in GitHub Desktop.
Save kevinswiber/1135641 to your computer and use it in GitHub Desktop.
Easy config.js API for NRack.Mixups.JavaScript
public override void Start()
{
var context = IronJsBootstrap.Initialize();
WireUpJavaScriptConfigurationObject(context);
var source = GetSourceString();
context.Execute(@"(function () {
var config = new Config();
function run (obj) { config.run(obj); }
function use (obj) { config.use(obj); }
function map (str, obj) { config.map(str, obj); }" +
System.Environment.NewLine + source + System.Environment.NewLine +
@"})();");
}
(function () {
var config = new Config();
function run (obj) { config.run(obj); }
function use (obj) { config.use(obj); }
function map (str, obj) { config.map(str, obj); }
// config.js source contents
var helloWorld = require("./app/helloWorld"),
methodOverride = require("./app/methodOverride");
use(methodOverride);
run(helloWorld);
//
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment