Transcript of talk: "Using KJSEmbed in KDE Applications"

KDE Contributor and Developer Conference

Notes taken by: Jonathan Riddell (these are not official material)

More information on the talk can be found here

Rich Moore took the JavaScript engine and bound it to Qt (KJS). It is small (about 400K) and easy to embed, it's not the fastest but it is sufficiently responsive. Easy to extend with new bindings and easy to embed using a rich C++ interface.

Where does KJSEmbed fit into KDE? Programmers usually use C++, with DCOP and KParts being available since KDE 2. But these tools carry the typical C++ problems of compilation and binary (in)compatability. KJSEmbed can make use of C++, DCOP and Kparts with JavaScript (KJS). It can use almost any KDE widget, any QObject can be bound with one line of code, and there are no problems with binary compatibility or different architectures. It is ideal for embedding JavaScript plugins in C++ programs.

KJSEmbed makes a lot of business sense. Many business problems need just set logic and string manipulation which works great with KJSEmbed, because it inherits PCRE (Perl's regular expression library) and JavaScript's string handling capabilities.

Then followed lots of technical stuff including code - look at the slides when they're available.

KJSEmbed is quickly evolving. SourceXtreme uses it for some utility tasks like post labels or printing tasks. The future will bring better memory management fixing issues with pointers between C++ and JavaScript. It will be faster thanks to Apple. More bindings for Qt and KDE, Qt4 will make it more powerful. More developers are welcome.

Are there applications using KJSEmbed? amarok does. Kexi is talking about it, Kopete uses it, some applications in CVS. Could be used in KDevelop and KOffice.

There is an XSLT stylesheet to convert doxygen to bindings. Looking at tools to automate the creation of bindings.

I don't like JavaScipt, can this framework be used with other languages? Theoreticly this is possible e.g. they have considered using other JavaScript engines if they were faster. Python has been toyed with but he's not sure what the point would be since there are other tools.

Smoke library already solves this problem. People have brought this up to KJSEmbed developers but they havn't worked it out yet.

[ Edit ]