public class ReloadableScript extends Object
| Constructor and Description |
|---|
ReloadableScript(Resource source,
RhinoEngine engine)
Construct a Script from the given script resource.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addDependency(ReloadableScript script)
Register a script that this script depends on.
|
protected Object |
compileScript(org.mozilla.javascript.Context cx)
Get a script from a single script file.
|
boolean |
equals(Object obj)
Equal check delegates to source.
|
Object |
evaluate(org.mozilla.javascript.Scriptable scope,
org.mozilla.javascript.Context cx,
RingoWorker worker)
Evaluate the script on a module scope and return the result
|
protected long |
getChecksum()
Get the checksum of the script.
|
protected long |
getNestedChecksum(Set<ReloadableScript> set)
Get the recursive checksum of this script as a dependency.
|
Object |
getScript(org.mozilla.javascript.Context cx,
RingoWorker worker)
Get the actual compiled script.
|
Resource |
getSource()
Get the script's source resource.
|
int |
hashCode()
Hash code delegates to source.
|
protected org.mozilla.javascript.Scriptable |
load(org.mozilla.javascript.Scriptable prototype,
org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable module,
RingoWorker worker)
Get a module scope loaded with this script
|
public ReloadableScript(Resource source, RhinoEngine engine)
source - the JavaScript resource or repository containing the script.engine - the rhino enginepublic Resource getSource()
public Object getScript(org.mozilla.javascript.Context cx, RingoWorker worker) throws org.mozilla.javascript.JavaScriptException, IOException
cx - the current Contextorg.mozilla.javascript.JavaScriptException - if an error occurred compiling the script codeIOException - if an error occurred reading the script fileprotected Object compileScript(org.mozilla.javascript.Context cx) throws org.mozilla.javascript.JavaScriptException, IOException
cx - the current Contextorg.mozilla.javascript.JavaScriptException - if an error occurred compiling the script codeIOException - if an error occurred reading the script filepublic Object evaluate(org.mozilla.javascript.Scriptable scope, org.mozilla.javascript.Context cx, RingoWorker worker) throws org.mozilla.javascript.JavaScriptException, IOException
scope - the scope to evaluate the script oncx - the rhino contextorg.mozilla.javascript.JavaScriptException - if an error occurred evaluating the script fileIOException - if an error occurred reading the script fileprotected org.mozilla.javascript.Scriptable load(org.mozilla.javascript.Scriptable prototype,
org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable module,
RingoWorker worker)
throws org.mozilla.javascript.JavaScriptException,
IOException
prototype - the prototype for the module, usually the shared top level scopecx - the rhino contextmodule - the preexisting module for this resource if availableworker - the worker instance loading this moduleorg.mozilla.javascript.JavaScriptException - if an error occurred evaluating the script fileIOException - if an error occurred reading the script fileprotected long getChecksum()
throws IOException
IOException - source could not be checked because of an I/O errorprotected long getNestedChecksum(Set<ReloadableScript> set) throws IOException
set - visited script set to prevent cyclic invokationIOException - source could not be checked because of an I/O errorprotected void addDependency(ReloadableScript script)
script - a script we depend onpublic int hashCode()
Copyright © 2016. All rights reserved.