Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Requirejs implementation

0
0
I think I may have found a solution for

First Chance Exception: RuntimeBinderException
Message: 'System.Dynamic.DynamicObject' does not contain a definition for 'moduleLoader'

http://www.codeproject.com/Articles/62839/Adventures-with-C-4-0-dynamic-ExpandoObject-Elasti
Type t = typeof (ModuleLoader);
dynamic moduleLoaderDefinedInClassLib = Activator.CreateInstance(t, engine);
engine.Script.moduleLoader = moduleLoaderDefinedInClassLib;
string currentDir = FileOperations.GetCurrentlyExecutingAssemblyLocation();
engine.Execute(File.ReadAllText(currentDir + @"\Scripts\require.js"));
engine.Execute(@"require.load = function (context, name, url) {
moduleLoader.LoadModuleAsync(context, name, url);
}");
In my case the ModuleLoader was defined in a class library project that the main executable referenced, so I think this was the reason the exception was thrown.

Still not clear what the context variable is though!

Viewing all articles
Browse latest Browse all 2297