The API is fairly simple:

Std(string) - accepts a comma-separated list of script file ids, either a name or an alias as defined in a <library> element in the jslibraries.xml file.

It will also accept “self” to load a script & CSS file based on the name of the view, i.e., if Script.Std(“self”) is used in /Home/Index, then it will load /Scripts/Views/Home/Index.js and /Content/Css/Home/index.css (if they exist on the file system).

AddScript(string id, string script) - accepts a block of script as text. Multiple calls with the same id are rendered only once.

AddScript(string script)- accepts a block of script as text. Each call is rendered. All script from either AddScript methods is rendered in a block at the script insertion point.

AddOnReadyScript(string script) --accepts a block of script as text, which is appended to the script run on page ready. All are rendered, wrapped in a jQuery document ready event function, at the point of InsertOnReady()

InsertScripts() -- Renders all script files & script blocks.

InsertOnReady() -- Renders all script block intended for startup, wrapped in a jQuery on ready function.

InsertCss()-- Renders all css files

Last edited Jun 20, 2012 at 11:32 PM by JamesCurran, version 1


No comments yet.