Presently, the JavascriptHelper is distributed as a single source file. (But that may change in the future. See the "Next Steps" section at the end). Just include it in your project.

The “JScripts” object needs to be created differently depending on where it is being used. (You can, of course, call it anything you like. I use “JScripts” with a capital J & S, so that it corresponds to @Html. Actually, I was using @Script, but Microsoft decided to use that name starting with MVC4RC)

When used in a view, create it like this:

@{ var JScripts = NovelTheory.Component.JavascriptHelper.Create(this); } 

When used inside a @helper method or an HtmlHelper extension method:

var JScripts = NovelTheory.Component.JavascriptHelper.Create(WebPageContext.Current); 

Last edited Jun 21, 2012 at 5:34 AM by JamesCurran, version 2


No comments yet.