@ SuppressWarnings ( "static-access" ) public static Object bindings ( Context cx , Scriptable thisObj , Object [ ] args , Function funObj ) { if ( args . length == 1 ) { Object arg = args [ 0 ] ; if ( arg instanceof Wrapper ) { arg = ( ( Wrapper ) arg ) . unwrap ( ) ; } if ( arg instanceof ExternalScriptable ) { ScriptContext ctx = ( ( ExternalScriptable ) arg ) . getContext ( ) ; Bindings bind = ctx . getBindings ( ScriptContext . ENGINE_SCOPE ) ; return Context . javaToJS ( bind , ScriptableObject . getTopLevelScope ( thisObj ) ) ; } } return cx . getUndefinedValue ( ) ; }
The bindings function takes a JavaScript scope object of type ExternalScriptable and returns the underlying Bindings instance .