You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdebindings/kjsembed/tests/test_dcop_interface.js

46 lines
1.0 KiB

#!/usr/bin/env kjscmd
function exitJavascript(exitValue )
{
println("Exiting the javascript now with " + exitValue);
exit(exitValue);
}
function doSomthing( message, maxTimes )
{
println( message + " " + maxTimes );
for( var times = 0; times < maxTimes; times++)
println(message);
return "Javascript said '" + message + "' " + maxTimes + " times.";
}
function test()
{
println("this is a test");
return 1;
}
function pixmap(color)
{
var pixmap = new Pixmap();
pixmap.resize( 25,25 );
pixmap.fill( color );
return pixmap;
}
function makeRef()
{
var client = new DCOPClient();
var ref = new DCOPRef(client.appId(), "someInterface");
return ref;
}
var dcop = new DCOPInterface(this, "someInterface"); // Create the DCOP object.
dcop.publish("void exitJavascript(int)"); // Publish a javascript function.
dcop.publish("QString doSomthing(QString,int)"); // Publish another javascript function.
dcop.publish("int test()");
dcop.publish("QPixmap pixmap(QString)");
dcop.publish("DCOPRef makeRef()");
application.exec(); // Start the event loop