JS
Assembly: ServiceStack.Common.dll
View Source
Declaration
public static class JS
Fields
EvalCacheKeyPrefix
View Source
Declaration
public const string EvalCacheKeyPrefix = "scriptvalue:"
EvalScriptCacheKeyPrefix
View Source
Declaration
public const string EvalScriptCacheKeyPrefix = "scriptvalue.script:"
EvalAstCacheKeyPrefix
View Source
Declaration
public const string EvalAstCacheKeyPrefix = "scriptvalue.ast:"
Methods
Configure()
Configure ServiceStack.Text JSON Serializer to use Templates JS parsing
View Source
Declaration
public static void Configure()
UnConfigure()
View Source
Declaration
public static void UnConfigure()
CreateScope(Dictionary<String, Object>, ScriptMethods)
View Source
Declaration
public static ScriptScopeContext CreateScope(Dictionary<string, object> args = null, ScriptMethods functions = null)
Returns
ServiceStack.Script.ScriptScopeContext
Parameters
Type | Name |
---|---|
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
ServiceStack.Script.ScriptMethods | functions |
expression(String)
Parse JS Expression into an AST Token
View Source
Declaration
public static JsToken expression(string js)
Returns
Parameters
Type | Name |
---|---|
System.String | js |
expressionCached(ScriptContext, String)
Returns cached AST of a single expression
View Source
Declaration
public static JsToken expressionCached(ScriptContext context, string expr)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | expr |
scriptCached(ScriptContext, String)
Returns cached AST of a script
View Source
Declaration
public static SharpPage scriptCached(ScriptContext context, string evalCode)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | evalCode |
eval(String)
View Source
Declaration
public static object eval(string js)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.String | js |
eval(String, ScriptScopeContext)
View Source
Declaration
public static object eval(string js, ScriptScopeContext scope)
Returns
System.Object
Parameters
Type | Name |
---|---|
System.String | js |
ServiceStack.Script.ScriptScopeContext | scope |
eval(ReadOnlySpan<Char>, ScriptScopeContext)
View Source
Declaration
public static object eval(ReadOnlySpan<char> js, ScriptScopeContext scope)
Returns
System.Object
Parameters
Type | Name |
---|---|
ReadOnlySpan<System.Char> | js |
ServiceStack.Script.ScriptScopeContext | scope |
eval(ScriptContext, String, Dictionary<String, Object>)
View Source
Declaration
public static object eval(ScriptContext context, string expr, Dictionary<string, object> args = null)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | expr |
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
eval(ScriptContext, ReadOnlySpan<Char>, Dictionary<String, Object>)
View Source
Declaration
public static object eval(ScriptContext context, ReadOnlySpan<char> expr, Dictionary<string, object> args = null)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
ReadOnlySpan<System.Char> | expr |
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
eval(ScriptContext, JsToken, Dictionary<String, Object>)
View Source
Declaration
public static object eval(ScriptContext context, JsToken token, Dictionary<string, object> args = null)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
ServiceStack.Script.JsToken | token |
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
evalCached(ScriptContext, String)
Lightweight expression evaluator of a single JS Expression with results cached in global context cache
View Source
Declaration
public static object evalCached(ScriptContext context, string expr)
Returns
System.Object
Parameters
Type | Name |
---|---|
ServiceStack.Script.ScriptContext | context |
System.String | expr |
ParseObject(String)
View Source
Declaration
public static Dictionary<string, object> ParseObject(string js)
Returns
System.Collections.Generic.Dictionary<System.String,System.Object>
Parameters
Type | Name |
---|---|
System.String | js |