Created
August 10, 2011 00:31
-
-
Save kevinswiber/1135641 to your computer and use it in GitHub Desktop.
Easy config.js API for NRack.Mixups.JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 + | |
@"})();"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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