I believe so. You might run into issues with the file system module.
If you're targetting windows, any help in testing and getting the file
system library up to speed for that platform would be appreciated.
> ASP and Jaxer are "page based", for lack of a better term, and would
> require something like:
>
> <script runat="server" src="narwhal.js"></script>
> <script runat="server">var File = require("file").File; ... </script>
I think that for Jaxer and ASP, you can bypass bin/narwhal (which just
finds itself and calls platforms/*/bin/narwhal-*), and you can bypass
platforms/*/bin/narwhal-* (which just finds the engine and executes
platforms/*/bootstrap.js) and go straight to platforms/*/bootstrap.js.
<script runat="server"
src="/path/to/narwhal/platforms/jaxer/bootstrap.js"></script>
bootstrap.js is responsible for creating an initial "system" object
with temporary versions of "isFile", "read", and a few other things,
then evaling "narwhal.js", which returns a function, and passing the
"system" object to that function. Voila.
For client scripts, I'll probably be setting something up like this:
<script src="//url/to/modules.js?main/module"></script>
Or, for cacheability, using a bit of Jack middleware for hosing
bundles with a loader:
<script src="//url/to/modules/main/module.js"></script>
Kris Kowal
You may have multiple platforms. For example, Rhino's system object
says {"platform": "rhino", "platforms": ["rhino", "default"]}. Yours
should presumably look like {"platform": "jaxer", "platforms":
["jaxer", "foo", "default"]} to share components with other "foo"
projects. Narwhal composes the platforms into a library search path
giving priority to the first platform in the array, like:
narwhal/platforms/jaxer/lib
narwhal/platforms/foo/lib
narwhal/platforms/default/lib
narwhal/lib
And uses the same order when looking for jars/, packages/, and bin/ directories.
Our current practice is to bifurcate modules with both pure-js
components and platform components into a bar.js module in lib or the
defaults platform and a bar-platform.js module in jaxer/lib or
foo/lib.
Kris Kowal
> It looks like Irakli's xulrunner and Cristoph's mozilla are almost
> identical, except Cristoph's uses the extension manager which is not
> available on Jaxer. It still would be nice to try and eliminate any
> duplication.
>
I will be looking at the merged xulrunner platform [1] and updating my
fork with any required patches to arrive at a single xulrunner base
platform.
> Most of the work needed now, as far as I can tell, will be on the
> xulrunner platform, so hopefully I can help out some on that.
>
That would be great. As far as I know there is still a lot missing.
Christoph
[1] - http://github.com/tlrobinson/narwhal/tree/master/platforms/xulrunner