| 35 | * 另一個互動式 JavaScript Shell - SpiderMonkey |
| 36 | * [安裝] Debian 已經有套件 - [http://packages.debian.org/etch/spidermonkey-bin spidermonkey-bin] |
| 37 | {{{ |
| 38 | $ sudo apt-get install spidermonkey-bin |
| 39 | $ dpkg -L spidermonkey-bin |
| 40 | $ smjs |
| 41 | js> help() |
| 42 | JavaScript-C 1.8.0 pre-release 1 2007-10-03 |
| 43 | Command Description |
| 44 | ======= =========== |
| 45 | version([number]) Get or set JavaScript version number |
| 46 | options([option ...]) Get or toggle JavaScript options |
| 47 | load(['foo.js' ...]) Load files named by string arguments |
| 48 | readline() Read a single line from stdin |
| 49 | print([exp ...]) Evaluate and print expressions |
| 50 | help([name ...]) Display usage and help messages |
| 51 | quit() Quit the shell |
| 52 | gc() Run the garbage collector |
| 53 | gcparam(name, value) |
| 54 | Wrapper for JS_SetGCParameter. The name must be either 'maxBytes' or |
| 55 | 'maxMallocBytes' and the value must be convertable to a positive uint32 |
| 56 | countHeap([start[, kind]]) |
| 57 | Count the number of live GC things in the heap or things reachable from |
| 58 | start when it is given and is not null. kind is either 'all' (default) to |
| 59 | count all things or one of 'object', 'double', 'string', 'function', |
| 60 | 'qname', 'namespace', 'xml' to count only things of that kind |
| 61 | trap([fun, [pc,]] exp) Trap bytecode execution |
| 62 | untrap(fun[, pc]) Remove a trap |
| 63 | line2pc([fun,] line) Map line number to PC |
| 64 | pc2line(fun[, pc]) Map PC to line number |
| 65 | stackQuota([number]) Query/set script stack quota |
| 66 | stringsAreUTF8() Check if strings are UTF-8 encoded |
| 67 | testUTF8(mode) Perform UTF-8 tests (modes are 1 to 4) |
| 68 | throwError() Throw an error from JS_ReportError |
| 69 | build() Show build date and time |
| 70 | clear([obj]) Clear properties of object |
| 71 | intern(str) Internalize str in the atom table |
| 72 | clone(fun[, scope]) Clone function object |
| 73 | seal(obj[, deep]) Seal object, or object graph if deep |
| 74 | getpda(obj) Get the property descriptors for obj |
| 75 | getslx(obj) Get script line extent |
| 76 | toint32(n) Testing hook for JS_ValueToInt32 |
| 77 | evalcx(s[, o]) |
| 78 | Evaluate s in optional sandbox object o |
| 79 | if (s == '' && !o) return new o with eager standard classes |
| 80 | if (s == 'lazy' && !o) return new o with lazy standard classes |
| 81 | sleep(dt) Sleep for dt seconds |
| 82 | scatter(fns) Call functions concurrently (ignoring errors) |
| 83 | js> |
| 84 | }}} |