4
4
< meta charset ="utf-8 ">
5
5
< title > JS-Interpreter Documentation</ title >
6
6
< link href ="demos/style.css " rel ="stylesheet " type ="text/css ">
7
+ < style >
8
+ h2 {
9
+ background-color : # f7df1e ;
10
+ padding-left : 1ex ;
11
+ }
12
+ </ style >
7
13
</ head >
8
14
< body >
9
15
< img src ="logo.png " height =200 width =200 style ="float: right ">
@@ -19,7 +25,7 @@ <h1>JS-Interpreter Documentation</h1>
19
25
20
26
< p > Get the < a href ="https://github.com/NeilFraser/JS-Interpreter "> source code</ a > .</ p >
21
27
22
- < h2 > Usage</ h2 >
28
+ < h2 id =" usage " > Usage</ h2 >
23
29
24
30
< p > Start by including the two JavaScript source files:</ p >
25
31
@@ -76,7 +82,7 @@ <h2>Usage</h2>
76
82
< code > run</ code > will return true if it is blocked and needs to be called
77
83
again at a later time.</ p >
78
84
79
- < h2 > External API</ h2 >
85
+ < h2 id =" external_api " > External API</ h2 >
80
86
81
87
< p > Similar to the < code > eval</ code > function, the result of the last
82
88
statement executed is available in < code > myInterpreter.value</ code > :</ p >
@@ -165,7 +171,7 @@ <h2>External API</h2>
165
171
< p > For a working example, see the
166
172
< a href ="demos/async.html "> async demo</ a > .</ p >
167
173
168
- < h2 > Serialization</ h2 >
174
+ < h2 id =" serialization " > Serialization</ h2 >
169
175
170
176
< p > A unique feature of the JS-Interpreter is its ability to pause execution,
171
177
serialize the current state, then resume the execution at that point at a
@@ -189,7 +195,7 @@ <h2>Serialization</h2>
189
195
< p > Another example shows how to use serialization of every step to enable
190
196
< a href ="demos/backwards.html "> stepping backwards</ a > .</ p >
191
197
192
- < h2 > Threading</ h2 >
198
+ < h2 id =" threading " > Threading</ h2 >
193
199
194
200
< p > JavaScript is single-threaded, but the JS-Interpreter allows one to run
195
201
multiple threads at the same time. Creating two or more completely
@@ -209,7 +215,7 @@ <h2>Threading</h2>
209
215
< p > For a working example, see the
210
216
< a href ="demos/thread.html "> thread demo</ a > .</ p >
211
217
212
- < h2 > Status</ h2 >
218
+ < h2 id =" status " > Status</ h2 >
213
219
214
220
< p > A JS-Intepreter instance has a < code > getStatus</ code > function that returns
215
221
information about what the interpreter is doing. The return values are one of:</ p >
@@ -232,7 +238,7 @@ <h2>Status</h2>
232
238
< p > This status information might be used to determine whether to take another
233
239
step immediately, or call setTimeout and step later, or stop.</ p >
234
240
235
- < h2 > Security</ h2 >
241
+ < h2 id =" security " > Security</ h2 >
236
242
237
243
< p > A common use-case of the JS-Interpreter is to sandbox potentially hostile
238
244
code. The interpreter is secure by default: it does not use blacklists to
@@ -249,15 +255,15 @@ <h2>Security</h2>
249
255
grows too large. For a working example, see the
250
256
< a href ="demos/size.html "> size demo</ a > .</ p >
251
257
252
- < h2 > Regular Expressions</ h2 >
258
+ < h2 id =" regular_expressions " > Regular Expressions</ h2 >
253
259
254
260
< p > Pathological regular expressions can execute in geometric time. For example
255
261
< code > 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac'.match(/^(a+)+b/)</ code >
256
262
will effectively crash any JavaScript runtime. JS-Interpreter has a
257
263
variety of methods for < a href ="demos/regexp.html "> safely dealing with
258
264
regular expressions</ a > depending on the platform.</ p >
259
265
260
- < h2 > Limitations</ h2 >
266
+ < h2 id =" limitations " > Limitations</ h2 >
261
267
262
268
< p > The version of JavaScript implemented by the interpreter has a few
263
269
differences from that which executes in a browser:</ p >
@@ -283,12 +289,12 @@ <h2>Limitations</h2>
283
289
200 times slower than native JavaScript.</ dd >
284
290
</ dl >
285
291
286
- < h2 > Node.js</ h2 >
292
+ < h2 id =" node_js " > Node.js</ h2 >
287
293
288
294
< p > JS-Intepreter can be run server-side using Node.js. For a minimal demo,
289
295
just run: < code > node < a href ="demos/node.js "> demos/node.js</ a > </ code > </ p >
290
296
291
- < h2 > Dependency</ h2 >
297
+ < h2 id =" dependency " > Dependency</ h2 >
292
298
293
299
< p > The only dependency is < a href ="https://github.com/acornjs/acorn "> Acorn</ a > ,
294
300
a beautifully written JavaScript parser by Marijn Haverbeke. A minimal
@@ -299,7 +305,7 @@ <h2>Dependency</h2>
299
305
doesn't use. There's no benefit in doing so unless your project already uses
300
306
Acorn for something else.</ p >
301
307
302
- < h2 > Compatibility</ h2 >
308
+ < h2 id =" compatibility " > Compatibility</ h2 >
303
309
304
310
< p > The limiting factor for browser support is the use of
305
311
< a href ="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create "> < code > Object.create(null)</ code > </ a >
@@ -321,8 +327,5 @@ <h2>Compatibility</h2>
321
327
< p > Additionally, if safely executing regular expressions is required, then
322
328
IE 11 is the minimum version of IE that supports Web Workers via Blobs.</ p >
323
329
324
- < h2 > Disclaimer</ h2 >
325
-
326
- < p > This project is not an official Google product.</ p >
327
330
</ body >
328
331
</ html >
0 commit comments