DHTML Notepad activity

Luke Closs lukecloss at gmail.com
Tue Apr 15 02:52:46 EDT 2008


Thanks to some help from some developers at a MozCamp this weekend, I made
significant progress on the python->javascript communication challenge.

In preparation for integrating Socialcalc with the journal, I've created a
sample activity called OnePageWiki that is basically a notepad in a HTML
page that saves and loads from the journal.  With this in place, it should
be very easy to integrate with Socialcalc, or other HTML and Javascript
based applications.

The activity code uses my new package - XOCom (like XPCom but easier), and a
library called xo.js to register javascript callbacks in the web page being
displayed.  This sample activity just saves and loads the content to a
textarea.  In XOCom, Python communicates with javascript through the
nsIObserverService, where messages are passed synchronously to the
javascript observer.  Python creates a mutable array, and sends this with
the notification to the javascript.  The javascript can read parameters from
the array, or stick new values back in the array to return data to python.

The code is available here:
  http://github.com/lukec/xocom

And you can install the latest package from here:

http://github.com/lukec/xocom/tree/master%2FOnePageWikiActivity-1.xo?raw=true
  (or: http://tinyurl.com/6jye6z)

Feedback or patches are welcome.

Cheers,
Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080414/e42305be/attachment.html>


More information about the Devel mailing list