We are glad to announce PharoJS, which is an infrastructure to run Pharo code on top of JavaScript. The goal of PharoJS is to allow developers benefit from the power of Pharo while targeting platforms that support JavaScript.
For example, PharoJS can be used to develop client side web applications. It can also be used to support cross-platform mobile apps based on Phone Gap.
PharoJS is freely available under MIT License. It can be dowloaded from SmalltalkHub.
this looks very cool indeed.
I have downloaded the code, and the web browser shows that the JavaScript functions are loaded when I go to local host:12345.
However, evaluating code in the workspace doesn’t show anything in the browser console. No errors in either the web browser it pharo 4.0.
Where should I start to looking for the problem?
You need to launch PharoJS workspace. In a plain workspace or GT playground evaluate the following expression:
workspace := JbWorkspaceForWeb open.
This will open pink workspace, this is the current PharoJS workspace. It also launches a server on Pharo side and opens a web browser that is connected to the server. Now, you can evaluate any Smalltalk expression, and see it performing on the web browser.
To load a class defined in Pharo, say the JbCounter example provided with PharoJS, you need to go back to the plain Pharo workspace and evaluate:
workspace javaScriptBridge loadClass: JbCounter.
You’ll see on the web browser that the JbCounter javascript code was generated and loaded. Now, you can play with the JbCoutner in the PharoJS (pink) workspace, and evaluate expressions such as:
counter := JbCounter new.
counter count.
counter increment.
I’m making a video showing this and more. It will be soon online :-)
Hi,
I tried first step –
workspace := JbWorkspaceForWeb open.
The next sentence is throwing error
workspace javaScriptBridge loadClass: JbCounter.
It is throwing Message Does not understand exception
Could you please help me on this. I am new to pharo and smalltalk. I was able to produce some visualization using Roassal. Now want to convert them into javascript