[X3D-Public] [x3dom-developers] Fwd: [X3D] Comment: need ability to import separate Javascript source library into embedded X3D Script code

Leonard Daly web3d at realism.com
Sun Dec 7 09:02:18 PST 2014


John,

Thanks for replying and contributing to the discussion. I hope I am 
following your comments correctly.

In X3D (not necessarily X3DOM), a Script node defines a new name space. 
The only way to communication between functions in different Script 
nodes is to pass events OR directly access the other node's events 
(directAccess='TRUE'). If you were to read in a Script node in an 
external X3D file (e.g., via GetX3dFromURL), then that Script node would 
be in a separate namespace as above.

Don's comment relates a desire to import JavaScript (formally 
ECMAScript) into an existing Script node so that functions and data in 
the imported file could be accessed directly via ECMAScript's standard 
mechanisms (call, data access, etc.). This is a really important feature 
for ECMAScript libraries.

There was a previous comment that is a feature that allows this to 
happen using 'required'. I cannot find that feature in the ECMAScript 
Language Specification at 
http://www.ecma-international.org/ecma-262/5.1/ If it is not in the 
ECMAScript specification, then it is not supported in the X3D Script 
node. The X3D specification development team did not consider the impact 
of such a feature. If it is in the specification, then a review of the 
specification needs to performed to make sure everything operates as 
intended.

Also the AJAX functions XHR* and XHttp* are not in the ECMAScript 
specification so that it would not be possible to access the external 
file and 'eval' it.


Leonard Daly




> How is it different than reading the url into a string say with ajax 
> and then eval'ling the string?  Perhaps I'm missing something.
>
> On Dec 7, 2014 6:47 AM, "John Carlson" <yottzumm at gmail.com 
> <mailto:yottzumm at gmail.com>> wrote:
>
>     Oh, I see.  I didn't realize web browsers supported require.  
>     This may be a bigger change than you think.  However for X3D 
>     server side,  it might be useful for libraries.
>
>     On Dec 7, 2014 6:39 AM, "John Carlson" <yottzumm at gmail.com
>     <mailto:yottzumm at gmail.com>> wrote:
>
>         What about the url attribute for script?
>
>         On Dec 7, 2014 6:35 AM, "John Carlson" <yottzumm at gmail.com
>         <mailto:yottzumm at gmail.com>> wrote:
>
>             Eh, <script> doesn't support the src attribute????
>
>             On Dec 4, 2014 2:23 AM, "Don Brutzman" <brutzman at nps.edu
>             <mailto:brutzman at nps.edu>> wrote:
>
>                 Comments on this issue welcome.  Seems like a big
>                 omission if indeed there is no way for an author to
>                 load an external Javascript library into a Script node
>                 internal to an X3D scene.
>
>
>                 -------- Forwarded Message --------
>                 Subject: [X3D] Comment on Specification by "brutzman"
>                 Date: Wed, 3 Dec 2014 09:14:09 -0800
>                 From: Spec Feedback <spec-comment at web3d.org
>                 <mailto:spec-comment at web3d.org>>
>                 To: x3d at web3d.org <mailto:x3d at web3d.org>
>
>                 Comment on 19777-1: JavaScript Binding - V3.3
>                 4 Concepts
>                 http://www.web3d.org/documents/specifications/19777-1/V3.0/Part1/concepts.html
>
>                 -----------------
>                 No method currently exists to import source for an
>                 external Javascript
>                 library into an embedded X3D Script node.
>
>                 The ECMAScript specification reserves keywords "import
>                 export" but does not
>                 define functionality.
>                 http://www.web3d.org/specifications/Ecma-262.pdf
>
>                 HTML supports multiple javascript libraries in the web
>                 page via the  element.
>                 http://www.w3.org/TR/html401/interact/scripts.html
>                 http://www.w3.org/TR/html5/scripting-1.html
>
>                 X3D needs a similar mechanism where an X3D Script
>                 author can use/reuse an
>                 external Javascript library.
>                 -----------------
>
>                 Submitted on Wednesday, 2014,  December 3 - 9:14am
>                 by brutzman (brutzman )
>                 IP: 205.155.65.226
>
>

-- 
*Leonard Daly*
X3D Co-Chair
Cloud Consultant
President, Daly Realism - /Creating the Future/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20141207/b84afc63/attachment.html>


More information about the X3D-Public mailing list