Created
May 24, 2012 13:42
-
-
Save jbeard4/2781612 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.mozilla.javascript.Scriptable; | |
import org.mozilla.javascript.Function; | |
import org.mozilla.javascript.Context; | |
import org.mozilla.javascript.ScriptableObject; | |
import test.Reduced; | |
class TestReduced { | |
public static void main(String[] args){ | |
Reduced reduced = new Reduced(); | |
Scriptable o = (Scriptable) reduced.getObj(); | |
System.out.println("js object:"); | |
System.out.println(o); | |
Scriptable scope = o.getParentScope(); | |
System.out.println("scope:"); | |
System.out.println(scope); | |
Function getXFn = (Function) ScriptableObject.getProperty(o,"getX"); | |
System.out.println("getX function:"); | |
System.out.println(getXFn); | |
//this will always be null. | |
//how do we get the context? | |
Context context = Context.getCurrentContext(); | |
System.out.println("context:"); | |
System.out.println(context); | |
Object[] getXFnArgs = {}; | |
getXFn.call(context,scope,o,getXFnArgs); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment