Skip to main content

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
TypeName
System.Collections.Generic.Dictionary<System.String,System.Object>args
ServiceStack.Script.ScriptMethodsfunctions

expression(String)

Parse JS Expression into an AST Token

View Source
Declaration
public static JsToken expression(string js)
Returns

ServiceStack.Script.JsToken

Parameters
TypeName
System.Stringjs

expressionCached(ScriptContext, String)

Returns cached AST of a single expression

View Source
Declaration
public static JsToken expressionCached(ScriptContext context, string expr)
Returns

ServiceStack.Script.JsToken

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringexpr

scriptCached(ScriptContext, String)

Returns cached AST of a script

View Source
Declaration
public static SharpPage scriptCached(ScriptContext context, string evalCode)
Returns

ServiceStack.Script.SharpPage

Parameters
TypeName
ServiceStack.Script.ScriptContextcontext
System.StringevalCode

eval(String)

View Source
Declaration
public static object eval(string js)
Returns

System.Object

Parameters
TypeName
System.Stringjs

eval(String, ScriptScopeContext)

View Source
Declaration
public static object eval(string js, ScriptScopeContext scope)
Returns

System.Object

Parameters
TypeName
System.Stringjs
ServiceStack.Script.ScriptScopeContextscope

eval(ReadOnlySpan<Char>, ScriptScopeContext)

View Source
Declaration
public static object eval(ReadOnlySpan<char> js, ScriptScopeContext scope)
Returns

System.Object

Parameters
TypeName
ReadOnlySpan<System.Char>js
ServiceStack.Script.ScriptScopeContextscope

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
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringexpr
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
TypeName
ServiceStack.Script.ScriptContextcontext
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
TypeName
ServiceStack.Script.ScriptContextcontext
ServiceStack.Script.JsTokentoken
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
TypeName
ServiceStack.Script.ScriptContextcontext
System.Stringexpr

ParseObject(String)

View Source
Declaration
public static Dictionary<string, object> ParseObject(string js)
Returns

System.Collections.Generic.Dictionary<System.String,System.Object>

Parameters
TypeName
System.Stringjs