~ubuntu-branches/ubuntu/karmic/rhino/karmic

« back to all changes in this revision

Viewing changes to docs/examples.html

  • Committer: Bazaar Package Importer
  • Author(s): Jerry Haltom
  • Date: 2005-03-19 16:56:07 UTC
  • mto: (11.1.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20050319165607-geu3j3fnqlkpqkh1
Tags: upstream-1.6.R1
ImportĀ upstreamĀ versionĀ 1.6.R1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
2
 
<html>
3
 
<head>
4
 
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5
 
   <meta name="Author" content="Norris Boyd">
6
 
   <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
7
 
   <title>Rhino Examples</title>
8
 
</head>
9
 
<body bgcolor="#FFFFFF">
10
 
 
11
 
<center>
12
 
<h1>
13
 
Rhino Examples</h1></center>
14
 
Examples have been provided that show how to control the JavaScript engine
15
 
and to implement scriptable host objects. All the examples are in the cvs
16
 
tree at <tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/">mozilla/js/rhino/examples</a></tt>.
17
 
<br>&nbsp;
18
 
<h2>
19
 
Sample Scripts</h2>
20
 
The <tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/unique.js">unique.js</a></tt>
21
 
script allows printing unique lines from a file.
22
 
<p>The <tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/liveConnect.js">liveConnect.js</a></tt>
23
 
script shows a sample usage of LiveConnect (Java-to-JavaScript connectivity).
24
 
<p>The <tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/jsdoc.js">jsdoc.js</a></tt>
25
 
script is a JavaScript analog to Java's <tt>javadoc</tt>. It makes heavy
26
 
use of regular expressions.
27
 
<p>The <tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/checkParam.js">checkParam.js</a></tt>
28
 
script is a useful tool to check that <tt>@param</tt> tags in Java documentation
29
 
comments match the parameters in the corresponding Java method.
30
 
<p>The <tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/enum.js">enum.js</a></tt>
31
 
script is a good example of using a JavaAdapter to implement a Java interface
32
 
using a JavaScript object.
33
 
<p>The <a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/NervousText.js">NervousText.js</a>
34
 
script is a JavaScript implementation of the famous NervousText applet
35
 
using JavaScript compiled to Java classes using <a href="jsc.html">jsc</a>.
36
 
It can be run in the HTML page <a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/NervousText.html">NervousText.html</a>.
37
 
<br>&nbsp;
38
 
<h2>
39
 
Controlling the JavaScript Engine</h2>
40
 
 
41
 
<h4>
42
 
The RunScript class</h4>
43
 
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/RunScript.java">RunScript.java</a></tt>
44
 
is a simple program that executes a script from the command line.
45
 
<h4>
46
 
The Control class</h4>
47
 
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/Control.java">Control.java</a></tt>
48
 
is a program that executes a simple script and then manipulates the result.
49
 
<h4>
50
 
JavaScript Shell</h4>
51
 
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/Shell.java">Shell.java</a></tt>
52
 
is a program that executes JavaScript programs; it is a simplified version
53
 
of the shell in the <tt>tools</tt> package. The programs may be specified
54
 
as files on the command line or by typing interactively while the shell
55
 
is running.
56
 
<h4>
57
 
<b>Multithreaded Script Execution</b></h4>
58
 
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/DynamicScopes.java">DynamicScopes.java</a></tt>
59
 
is a program that creates a single global scope object and then shares
60
 
it across multiple threads. Sharing the global scope allows both information
61
 
to be shared across threads, and amortizes the cost of Context.initStandardObjects
62
 
by only performing that expensive operation once.
63
 
<br>&nbsp;
64
 
<h2>
65
 
Implementing Host Objects</h2>
66
 
First check out the <a href="http://www.mozilla.org/rhino/tutorial.html">tutorial</a>
67
 
if you haven't already.
68
 
<h4>
69
 
The Foo class - Extending ScriptableObject</h4>
70
 
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/Foo.java">Foo.java</a></tt>
71
 
is a simple JavaScript host object that includes a property with an associated
72
 
action and a variable argument method.
73
 
<br>&nbsp;
74
 
<h4>
75
 
The Matrix class - Implementing Scriptable</h4>
76
 
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/Matrix.java">Matrix.java</a></tt>
77
 
provides a simple multidimensional array by implementing the Scriptable
78
 
interface.
79
 
<br>&nbsp;
80
 
<h4>
81
 
The File class - An advanced example</h4>
82
 
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/File.java">File.java</a></tt>
83
 
extends ScriptableObject to provide a means of reading and writing files
84
 
from JavaScript. A more involved example of host object definition.
85
 
<p>
86
 
<hr WIDTH="100%">
87
 
<br><a href="index.html">back to top</a>
88
 
</body>
89
 
</html>
 
1
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
 
2
<html>
 
3
<head>
 
4
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 
5
   <meta name="Author" content="Norris Boyd">
 
6
   <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]">
 
7
   <title>Rhino Examples</title>
 
8
</head>
 
9
<body bgcolor="#FFFFFF">
 
10
 
 
11
<center>
 
12
<h1>
 
13
Rhino Examples</h1></center>
 
14
Examples have been provided that show how to control the JavaScript engine
 
15
and to implement scriptable host objects. All the examples are in the cvs
 
16
tree at <tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/">mozilla/js/rhino/examples</a></tt>.
 
17
<br>&nbsp;
 
18
<h2>
 
19
Sample Scripts</h2>
 
20
The <tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/unique.js">unique.js</a></tt>
 
21
script allows printing unique lines from a file.
 
22
<p>The <tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/liveConnect.js">liveConnect.js</a></tt>
 
23
script shows a sample usage of LiveConnect (Java-to-JavaScript connectivity).
 
24
<p>The <tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/jsdoc.js">jsdoc.js</a></tt>
 
25
script is a JavaScript analog to Java's <tt>javadoc</tt>. It makes heavy
 
26
use of regular expressions.
 
27
<p>The <tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/checkParam.js">checkParam.js</a></tt>
 
28
script is a useful tool to check that <tt>@param</tt> tags in Java documentation
 
29
comments match the parameters in the corresponding Java method.
 
30
<p>The <tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/enum.js">enum.js</a></tt>
 
31
script is a good example of using a JavaAdapter to implement a Java interface
 
32
using a JavaScript object.
 
33
<p>The <a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/NervousText.js">NervousText.js</a>
 
34
script is a JavaScript implementation of the famous NervousText applet
 
35
using JavaScript compiled to Java classes using <a href="jsc.html">jsc</a>.
 
36
It can be run in the HTML page <a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/NervousText.html">NervousText.html</a>.
 
37
<br>&nbsp;
 
38
<h2>
 
39
Controlling the JavaScript Engine</h2>
 
40
 
 
41
<h4>
 
42
The RunScript class</h4>
 
43
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/RunScript.java">RunScript.java</a></tt>
 
44
is a simple program that executes a script from the command line.
 
45
<h4>
 
46
The Control class</h4>
 
47
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/Control.java">Control.java</a></tt>
 
48
is a program that executes a simple script and then manipulates the result.
 
49
<h4>
 
50
JavaScript Shell</h4>
 
51
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/Shell.java">Shell.java</a></tt>
 
52
is a program that executes JavaScript programs; it is a simplified version
 
53
of the shell in the <tt>tools</tt> package. The programs may be specified
 
54
as files on the command line or by typing interactively while the shell
 
55
is running.
 
56
<h4>PrimitiveWrapFactory</h4>
 
57
<a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/PrimitiveWrap
 
58
Factory.java">PrimitiveWrapFactory.java</a> is an example of a WrapFactory that
 
59
can be used to control the wrapping behavior of the Rhino engine on calls to Jav
 
60
a methods.<br>
 
61
<h4>
 
62
<b>Multithreaded Script Execution</b></h4>
 
63
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/DynamicScopes.java">DynamicScopes.java</a></tt>
 
64
is a program that creates a single global scope object and then shares
 
65
it across multiple threads. Sharing the global scope allows both information
 
66
to be shared across threads, and amortizes the cost of Context.initStandardObjects
 
67
by only performing that expensive operation once.
 
68
<br>&nbsp;
 
69
<h2>
 
70
Implementing Host Objects</h2>
 
71
First check out the <a href="http://www.mozilla.org/rhino/tutorial.html">tutorial</a>
 
72
if you haven't already.
 
73
<h4>
 
74
The Foo class - Extending ScriptableObject</h4>
 
75
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/Foo.java">Foo.java</a></tt>
 
76
is a simple JavaScript host object that includes a property with an associated
 
77
action and a variable argument method.
 
78
<br>&nbsp;
 
79
<h4>
 
80
The Matrix class - Implementing Scriptable</h4>
 
81
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/Matrix.java">Matrix.java</a></tt>
 
82
provides a simple multidimensional array by implementing the Scriptable
 
83
interface.
 
84
<br>&nbsp;
 
85
<h4>
 
86
The File class - An advanced example</h4>
 
87
<tt><a href="http://lxr.mozilla.org/mozilla/source/js/rhino/examples/File.java">File.java</a></tt>
 
88
extends ScriptableObject to provide a means of reading and writing files
 
89
from JavaScript. A more involved example of host object definition.
 
90
<p>
 
91
<hr WIDTH="100%">
 
92
<br><a href="index.html">back to top</a>
 
93
</body>
 
94
</html>