WriteScript() public method

Generates JavaScript functions to evaluate patterns client side
public WriteScript ( TextManager manager, string clientClassName, TextWriter output, LanguageInfo language = null, string defaultNamespace = null, Func filter = null, bool includeScriptTags = true ) : void
manager TextManager The text manager to extract texts from.
clientClassName string The client name of the generated object. (The script will be var clientClassName = ...)
output TextWriter The generated javascript will be written to this generator.
language LanguageInfo The language for the generated texts (if different from current language).
defaultNamespace string The default namespace for texts. (Set this to your assembly's namespace in plugins)
filter Func Specify this to only include a subset of the TextManager's texts.
includeScriptTags bool Wraps the generated script in <script> blocks if true.
return void
        /// <summary>
        /// Creates a JavaScript class to use the TextManager's texts client-side
        /// </summary>
        /// <param name="manager">The manager.</param>
        /// <param name="clientClassName">Name of the class.</param>
        /// <param name="language">The language for the generated texts (if different from current language).</param>
        /// <param name="defaultNamespace">The default namespace for texts. (Set this to your assembly's namespace in plugins)</param>
        /// <param name="filter">Specify this to only include a subset of the TextManager's texts.</param>
        /// <param name="includeScriptTags">Wraps the generated script in &lt;script&gt; blocks if <c>true</c>.</param>
        /// <returns></returns>
        public static HtmlString WriteScript(this TextManager manager, string clientClassName, LanguageInfo language = null,
                                             string defaultNamespace = null, Func <string, string, bool> filter = null, bool includeScriptTags = true)
        {
            var generator = new JavaScriptGenerator();

            using (var s = new StringWriter())
            {
                generator.WriteScript(manager, clientClassName, s, language, defaultNamespace, filter, includeScriptTags);
                return(new HtmlString(s.ToString()));
            }
        }
 /// <summary>
 /// Creates a JavaScript class to use the TextManager's texts client-side
 /// </summary>
 /// <param name="manager">The manager.</param>
 /// <param name="clientClassName">Name of the class.</param>
 /// <param name="language">The language for the generated texts (if different from current language).</param>
 /// <param name="defaultNamespace">The default namespace for texts. (Set this to your assembly's namespace in plugins)</param>
 /// <param name="filter">Specify this to only include a subset of the TextManager's texts.</param>
 /// <param name="includeScriptTags">Wraps the generated script in &lt;script&gt; blocks if <c>true</c>.</param>
 /// <returns></returns>
 public static HtmlString WriteScript(this TextManager manager, string clientClassName, LanguageInfo language = null,
     string defaultNamespace = null, Func<string, string, bool> filter = null, bool includeScriptTags = true)
 {
     var generator = new JavaScriptGenerator();
     using (var s = new StringWriter())
     {
         generator.WriteScript(manager, clientClassName, s, language, defaultNamespace, filter, includeScriptTags);
         return new HtmlString(s.ToString());
     }
 }