Skip to content

Commit 70a8f0a

Browse files
committed
add documentation and CHANGELOG entry
1 parent 3f22b0f commit 70a8f0a

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
This changelog summarizes major changes between GraalVM versions of the Graal JavaScript (ECMAScript) language runtime.
44
The main focus is on user-observable behavior of the engine.
55

6+
## Version 1.0.0 RC8
7+
* Provide simplified implementations for methods of the global `console` object.
8+
69
## Version 1.0.0 RC7
710
* Improved support for sharing of shapes between Contexts with the same Engine.
811
* BigInteger TypedArrays.

docs/user/JavaScriptCompatibility.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,26 @@ Source can be of type:
113113
* a JavaScript object: the object is queried for a `name` and a `script` property, which represent the source name and code, respectively.
114114
* all other types: the source is converted to a String.
115115

116-
#### `print(...arg)` and `console.log(...arg)`
116+
#### `print(...arg)`
117117

118118
Prints the arguments on the console.
119119
Provides a best-effort human readable output.
120120

121-
Note that `console.log` behaves differently when Graal JavaScript is executed in Node.js mode (i.e., the `node` executable is started instead of `js`).
122-
While normally, `console.log` is just an alias for `print`, on Node.js Node's own implementation is executed.
121+
#### Methods of the `console` global object
122+
123+
A global `console` object is provided that offers several methods for debugging purposes.
124+
These methods strive to provide similar functionality as provided in other engines, but do not guarantee identical results.
125+
126+
Note that those methods behave differently when Graal JavaScript is executed in Node.js mode (i.e., the `node` executable is started instead of `js`).
127+
Node.js provides its own implementation that is used instead.
128+
129+
* `console.log`, `console.info`, and `console.debug`: an alias for `print(...arg)`
130+
* `console.error`, and `console.warn`: similar to `print`, but using the error IO stream
131+
* `console.assert(check, message)`: prints `message` when `check` is falsy
132+
* `console.clear`: clears the console window if possible
133+
* `console.count()`, and `console.countReset()`: counts and print how many times it has been called, or resets this counter
134+
* `console.group`, and `console.groupEnd`: increases or decreases the indentation for succeeding outputs to the console
135+
* `console.time()`, `console.timeLog()`, and `console.timeEnd()`: starts a timer, prints the duration the timer has been active, or prints the duration and stops the timer, respectively
123136

124137
#### `read(file)` or `readFully(file)`
125138

0 commit comments

Comments
 (0)