Response
Class: Response
Defined in: packages/tagscript/src/lib/Interpreter/Response.ts:63
An object containing information on a completed TagScript process.
Constructors
Constructor
new Response(variables?, keyValues?): Response
Defined in: packages/tagscript/src/lib/Interpreter/Response.ts:126
Parameters
variables?
keyValues?
IKeyValues = {}
Returns
Response
Properties
actions
actions: IActions
Defined in: packages/tagscript/src/lib/Interpreter/Response.ts:93
An object containing information on a completed TagScript process. If you are creating a parser where you need to store info in actions, then you need to extend this interface.
import 'tagscript';
declare module 'tagscript' {
interface IActions {
foo?: string;
}
}body
body: string | null
Defined in: packages/tagscript/src/lib/Interpreter/Response.ts:72
The cleaned message with all tags interpreted.
errors
errors: TagScriptError[]
Defined in: packages/tagscript/src/lib/Interpreter/Response.ts:106
Every error a parser raised during the render, in the order they happened.
The render does not stop for these. A TemplateError has already been rendered into
body in place of its tag; a ParserError means a parser threw a bug and body got a
generic message instead, with the real error on its cause.
An empty array means the render was clean.
keyValues
keyValues: IKeyValues
Defined in: packages/tagscript/src/lib/Interpreter/Response.ts:95
raw
raw: string
Defined in: packages/tagscript/src/lib/Interpreter/Response.ts:67
The raw string that was used to generate this response.
spans
spans: OutputSpan[] | null
Defined in: packages/tagscript/src/lib/Interpreter/Response.ts:117
Which ranges of Response.body came from a tag rather than from the template author,
or null unless spans was on.
Needed by anything that has to treat generated text differently from written text, such as
escaping a value for the syntax of the document the body is dropped into. Recording them
costs time proportional to the square of the tag count, so it is off unless asked for, and
null rather than [] so that not asking is distinguishable from a template with no tags.
trace
trace: TraceStep[] | null
Defined in: packages/tagscript/src/lib/Interpreter/Response.ts:124
Every step of the render, in the order they ran, or null unless trace was on.
Tags are evaluated innermost first, so this is not document order.
variables
variables: object
Defined in: packages/tagscript/src/lib/Interpreter/Response.ts:77
An object with all the variables that parsers such as the LooseVarsParser can access.
Index Signature
[key: string]: ITransformer
Methods
setValues()
setValues(output, raw): Response
Defined in: packages/tagscript/src/lib/Interpreter/Response.ts:136
Parameters
output
string
raw
string
Returns
Response
toJSON()
toJSON(): object
Defined in: packages/tagscript/src/lib/Interpreter/Response.ts:160
Returns
object
actions
actions: IActions
body
body: string | null
errors
errors: TagScriptError[]
keyValues
keyValues: IKeyValues
raw
raw: string
variables
variables: object
Index Signature
[key: string]: ITransformer