Hi,

at the moment, like gwt, pyjs always loads in a hidden iframe (for obscure compression reasons), so javascript vars won't see each other between pyjs and pure javascript.

Look around "from __javascript__ import processBeforeShowing" (there is an example like that in the pyjs/examples folder), it should do the trick. Provided of course that you also add your js library to the build process (see command line args of builder).

Regards,
PKL



Le 24/02/2012 22:33, Matt Kelly a écrit :
Hi,

I'm working on a project for school and I'm trying to using a Javascript package called jsMath (http://www.math.union.edu/~dpvc/jsMath/ <http://www.math.union.edu/%7Edpvc/jsMath/>) to parse LaTeX tags within my Pyjamas application. Unfortunately, I have seen the warnings to use at little pure javascript stuff as possible but I don't know of any other solutions. That said I'm trying import jsMath in a way I can use two functions called jsMath.process() and jsMath.processBeforeShowing() so that I can grab text via RPC update the page and then have jsMath parse the new contents.

Typically all you do to get just math working is include the line

<SCRIPT SRC="/path-to-jsMath//easy/load.js"></SCRIPT>

and it goes off and does its thing.

I seen the examples of loading simple external javascript files using import so I tried

import jsMath.easy.load.js

and then tried to use my functions with JS

JS(""" jsMath.processBeforeShowing(); """)

but all I'm getting is "jsMath is not defined." I assumed part of this was because they weren't in the same directory so I tried moving them to the same directory and correcting to "import load.js"with the same results.

I also looked at jsimport() and tried that method (which seems to be deprecated?) and had no success either.

Am I doing something simple wrong?

Does this even seem possible or is jsMath just to large of a JS package to work correctly with Pyjamas?

Thanks,

Matt

Reply via email to