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
_______________________________________________
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel

Reply via email to