views:

157

answers:

1

The reference page (use "toggle all") for Processing.js says the import command remains unimplemented. It references a page for the Java Processing language that describes a usage pattern like this: import processing.opengl.*;

I see at Github that some work on the import command was committed to the root in May. Does anyone know how this syntax works in a JavaScript environment? It's not clear what the path to the library file and its assets would be. Does this depend on the use of an environment variable similar to PYTHONPATH, or is there a directory naming convention?

Finally, would you care to discuss the relative merits of the import command (assuming it now works) versus the approach described here, and discussed briefly here on StackOverflow.

A: 

I was looking for a similar solution. Perusing the processing.js base code, I noticed that you can simply list multiple files in your datasrc declaration if you separate the file names with spaces. That kind of does what I want, although the result is multiple ajax calls to load the separate scripts.

<canvas id="test" datasrc="resources/pjs/Spot.class.pjs resources/pjs/cursor.pjs"></canvas>

I think a cleaner solution, given the current state of the processing.js code (as of July 2010) would be to simply build a server-side code concatenator a-la minify:

http://groups.google.com/group/minify

Mason
But the console throws me an error: `Uncaught XMLHttpRequest failed, status code 404`. This is with the version 0.9.6. Any possible solution for this?
Nirmal