public abstract class JsScope
extends java.lang.Object
implements java.io.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(java.lang.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(java.lang.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. |
java.lang.CharSequence |
render()
Renders the scope.
|
public JsScope(java.lang.String... scopeParameters)
JsScope instance with the given args. This is the equivalent of the
JavaScript statement: function(arg1, arg2, arg3) {scopeParameters - public static JsScope quickScope(java.lang.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 java.lang.CharSequence render()
Copyright © 2021. All Rights Reserved.