Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "VJET/JavaScript Run As"
< VJET
(→VJET supports running JavaScript and vjojs) |
|||
Line 6: | Line 6: | ||
VJET provides a simple api for outputting to the console and is automatically wired into Rhino. vjo.sysout and vjo.syserr. This idea was borrowed from java System class. | VJET provides a simple api for outputting to the console and is automatically wired into Rhino. vjo.sysout and vjo.syserr. This idea was borrowed from java System class. | ||
− | |||
− | |||
add this file foo.js into vjet project | add this file foo.js into vjet project | ||
Line 25: | Line 23: | ||
yields in eclipse console | yields in eclipse console | ||
+ | <source lang=text> | ||
20.0 | 20.0 | ||
30.0 | 30.0 | ||
+ | </source> | ||
=== Simple JS Run with Web Browser === | === Simple JS Run with Web Browser === | ||
− | <source lang=javascript> | + | <source lang=javascript > |
function foo(a){ | function foo(a){ | ||
alert(a) | alert(a) | ||
Line 39: | Line 39: | ||
</source> | </source> | ||
− | should | + | should open web browser and display two alert boxes |
− | alert box with 20 in it | + | - alert box with 20 in it |
− | alert box with 30 in it | + | - alert box with 30 in it |
This should work with Indigo SR2 and Juno SR1 versions of Eclipse. | This should work with Indigo SR2 and Juno SR1 versions of Eclipse. |
Revision as of 15:09, 30 January 2013
VJET supports running JavaScript and vjojs
Simple JS Run with Rhino
Basic run as vjet js application should work for simple functions and vjojs.
VJET provides a simple api for outputting to the console and is automatically wired into Rhino. vjo.sysout and vjo.syserr. This idea was borrowed from java System class.
add this file foo.js into vjet project
function foo(a){ vjo.sysout.println(a) } foo(20); foo(30);
run as vjet js application
yields in eclipse console
20.0 30.0
Simple JS Run with Web Browser
function foo(a){ alert(a) } foo(20); foo(30);
should open web browser and display two alert boxes
- alert box with 20 in it - alert box with 30 in it
This should work with Indigo SR2 and Juno SR1 versions of Eclipse.