public abstract class JsScope extends Object implements Serializable
JsScope are used to define anonymous JavaScript functions. For
example, let's take the each statement:
new JsQuery().$(".foo").each(new JsScope() {
public void execute(JsScopeContext scopeContext) {
scopeContext.self().chain("css", "border", "1px solid red");
}
});
You can either pass arguments to the JsScope (like in JavaScript functions) (see constructor args).
JsStatement,
JsScopeContext,
Serialized Form| Constructor and Description |
|---|
JsScope(String... scopeParameters)
Constructs a new
JsScope instance with the given args. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
execute(JsScopeContext scopeContext)
Executes the
JsScope. |
static JsScope |
quickScope(CharSequence javascriptCode)
Creates a default
JsScope to execute the given statement. |
static JsScope |
quickScope(JsStatement jsStatement)
Creates a default
JsScope to execute the given statement. |
CharSequence |
render()
Renders the scope.
|
public static JsScope quickScope(CharSequence javascriptCode)
JsScope to execute the given statement.javascriptCode - the JavaScript statement to execute with the scope.JsScope.public static JsScope quickScope(JsStatement jsStatement)
JsScope to execute the given statement.jsStatement - the JavaScript statement to execute with the scope.JsScope.protected abstract void execute(JsScopeContext scopeContext)
JsScope.scopeContext - the given scope.public CharSequence render()
Copyright © 2009-2012. All Rights Reserved.