Canvas Nasal/JavaScript Subset: Difference between revisions

Jump to navigation Jump to search
m
→‎Background: http://forum.flightgear.org/viewtopic.php?f=6&t=25482&p=261254&hilit=subset+javascript#p261254
m (→‎Background: http://forum.flightgear.org/viewtopic.php?f=6&t=25482&p=261254&hilit=subset+javascript#p261254)
Line 12: Line 12:
Some kind of animation framework could then rewrite the animation logic to be valid JavaScript, so that the httpd can serve the code to the browser - while Canvas would internally keep using Nasal.
Some kind of animation framework could then rewrite the animation logic to be valid JavaScript, so that the httpd can serve the code to the browser - while Canvas would internally keep using Nasal.


== Canvas ==
The only way for the Canvas UI to provide a remote UI would be to serve SVG files via httpd/mongoose and hook them up to a subset of Nasal/JavaScript that both languages "understand", i.e. to set/get properties and invoke RPC functionality (e.g. fgcommands).
In the days prior to Phi, we actually toyed with the idea of not just using SVG in FG to create/render a widget via Canvas (ShivaVG), but to also serve SVG files with embedded code - since Torsten's Phi effort, that idea has become kinda obsolete.
But technically it would be possible to serve a SVG-based widget to a browser - for that to work, all callbacks added to events, would need to be valid JavaScript AND Nasal - even though it would be possible to dynamically recompile Nasal to be valid JavaScript (in fact, you could make Phi work with existing PUI/XML dialogs, including Nasal, doing exactly that)
And once you think about it, any Canvas could be represented as a SVG in memory and vice versa - including evne complex MFDs - i.e. we already have a parser that turns svg/xml into Canvas nodes, we could just as well have a parser doing the opposite to serve a Canvas node/group as SVG using a little serialization scheme.
Had this relationship been obvious earlier, SVG could in fact be the internal representation format of any Canvas
== Background ==
== Background ==
Given the recent mongoose/httpd work, we've been seeing some overlapping functionality that's already available in Nasal space, for which Torsten specifically implemented JavaScript wrappers, i.e. to expose the Property Tree and its listeners to JavaScript.
Given the recent mongoose/httpd work, we've been seeing some overlapping functionality that's already available in Nasal space, for which Torsten specifically implemented JavaScript wrappers, i.e. to expose the Property Tree and its listeners to JavaScript.

Navigation menu