BobHanson / java2script

Java2Script provides an Eclipse Java to JavaScript transpiler, with a nearly complete implementation of the Java Virtual Machine with AWT and Swing in JavaScript, with simple, automated parallel creation of both class files and js files. To date, over 600 applets have been converted.
https://chemapps.stolaf.edu/swingjs/examples.htm
Other
24 stars 11 forks source link

Change con.err() to con.error() #259

Closed benzoid closed 11 months ago

benzoid commented 1 year ago

Hi Bob, When trying to set Info = { ... console: window.console, ... } I got an error after launching jalviewjs: TypeError: con.err is not a function loading file swingjs/j2s/java/lang/Class.js TypeError: con.err is not a function at Con.consoleOutput (file://.../site/swingjs/swingjs2.js:16966:11) at file://.../site/swingjs/swingjs2.js:17302:33 at ... .

It looks like it should be error(s): this PR changes it in two files. There is a workaround of defining con.err(s) with window.console.err = function() { this.error.apply(this,arguments); } but presumably better to fix at source. Ben

P.S. The context of this is piping the sysoutdiv output to shell STDERR of chromium running in headless mode so that we can look for specific output of JalviewJS to detect launch, or other operations:

mkdir -p /tmp/chrome/TEMP touch "/tmp/chrome/TEMP/First Run" chrome \ --headless=new \ --timeout=15000 \ --virtual-time-budget=15000 \ --user-data-dir=/tmp/chrome \ --profile-directory=TEMP \ --allow-file-access-from-files \ --enable-logging=stderr \ ./site/launcher_with_window_console.html

BobHanson commented 1 year ago

Yes thanks. This was fixed some time ago in SwingJS, just did not get transmitted to Jalview.

On Fri, Jun 9, 2023, 2:48 PM benzoid @.***> wrote:

Hi Bob, When trying to set Info = { ... console: window.console, ... } I got an error after launching jalviewjs: TypeError: con.err is not a function loading file swingjs/j2s/java/lang/Class.js TypeError: con.err is not a function at Con.consoleOutput (file://.../site/swingjs/swingjs2.js:16966:11) at file://.../site/swingjs/swingjs2.js:17302:33 at ... .

It looks like it should be error(s): this PR changes it in two files. There is a workaround of defining con.err(s) with window.console.err = function() { this.error.apply(this,arguments); } but presumably better to fix at source. Ben

P.S. The context of this is piping the sysoutdiv output to shell STDERR of chromium running in headless mode so that we can look for specific output of JalviewJS to detect launch, or other operations:

mkdir -p /tmp/chrome/TEMP touch "/tmp/chrome/TEMP/First Run" chrome --headless=new --timeout=15000 --virtual-time-budget=15000 --user-data-dir=/tmp/chrome --profile-directory=TEMP --allow-file-access-from-files --enable-logging=stderr ./site/launcher_with_window_console.html

You can view, comment on, or merge this pull request online at:

https://github.com/BobHanson/java2script/pull/259 Commit Summary

File Changes

(2 files https://github.com/BobHanson/java2script/pull/259/files)

Patch Links:

— Reply to this email directly, view it on GitHub https://github.com/BobHanson/java2script/pull/259, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHNCW4I75NKTDP7AOLNBQLXKLS4TANCNFSM6AAAAAAZAMESEA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

BobHanson commented 11 months ago

no actual change was done in this merge