@@ -85,6 +85,51 @@ js.evaluate(script).then(function (res) {
8585In the example above the second request is sent in parallel, without waiting for the response from the first request.
8686
8787
88+ ## API
89+
90+ ##### new JSONScript(Object options) -> ; Object
91+
92+ Create JSONScript interpreter instance.
93+
94+
95+ ##### .validate(Any script) -> ; Boolean
96+
97+ Validate script. This method is called automatically before the script is evaluated.
98+
99+
100+ ##### .evaluate(Any script, Any data) -> ; Promise<Any >
101+
102+ Evaluate script. Returns Promise that resolves to the script evaluation result or rejects in case of validation or executor error.
103+
104+
105+ ##### .addExecutor(String name, Function|Object executor)
106+
107+ Add executor to the interpreter. Can be an object or a function with methods.
108+
109+
110+ ##### .addInstruction(Object definition, Function func)
111+
112+ Define JSONScript instruction. Core instructions are added using this method too.
113+
114+ ` definition ` should be valid according to the [ instruction schema] ( http://www.json-script.com/schema/instruction.json# ) .
115+
116+ ` func ` is the function used to evaluate instruction, it can return:
117+
118+ - Promise that resolves to the evaluation result
119+ - instance of Script that can contain:
120+ - a script that should be evaluated
121+ - a Promise that resolves to a script (for delayed evaluation).
122+
123+ Class ` Script ` is available as the property of both the class and the instance of JSONScript interpreter.
124+
125+
126+ ##### .addMacro(Object definition)
127+
128+ Define macro. Core macros are added using this method too.
129+
130+ ` definition ` should be valid according to the [ macro schema] ( http://www.json-script.com/schema/macro.json# ) .
131+
132+
88133## Language
89134
90135See [ JSONScript language documentation] ( https://github.com/JSONScript/jsonscript/blob/master/LANGUAGE.md ) for more information.
0 commit comments