expose custome object or function to script environementt

buddhi mihara buddhi.mihara at live.com
Wed Feb 5 00:46:17 PST 2014


what i mean is without using javascript we can use java to expose scriptObject to javascript environment.(just like Math Object. ). i need to add a function as a property of that function.(like abs function in Math Object). so i add a property called bind to my process object and when user ask
var foo = process.bind(param); i create a new object of bind class.(bind class is a class which inherits from JSObject class).what i ask is think if i need to add multiple function to scriptObject process in java level do i need to write a separate class which inherits from JSObject, for each of that function or is there any alternatives.
i asked this because in every global object like Math.oracle use following structure
@Function(attributes = Attribute.NOT_ENUMERABLE)    public static Object toString(final Object self) {        return getBoolean(self).toString();    }
i want to attach all the function to process object in java level
thank you 		 	   		  


More information about the nashorn-dev mailing list