blob: 37c11d5d2274d724b06121730a7ceaae35e47045 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/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("TQString doSomthing(TQString,int)"); // Publish another javascript function.
dcop.publish("int test()");
dcop.publish("TQPixmap pixmap(TQString)");
dcop.publish("DCOPRef makeRef()");
application.exec(); // Start the event loop
|