[x3d-public] Don, Re: ECMAScript 6 SAI proposal (simple for now).
John Carlson
yottzumm at gmail.com
Thu May 7 00:56:39 PDT 2020
Oh, it's okay with me if we leave the Node.js-X3DJSAIL X3dToNodeJS.xslt in
the trashbin. I believe I copied it from X3dToES5.xslt then modified it.
What I really want is a X3dToES6.xslt that follows modern ECMAScript
programming: classes/modules/import/export (one module OK with me to start
for simplicity). Please refer to www.web3d.org/x3d/stylesheets/es6 for
some example code.
I agree that a Node.js-X3DJSAIL attempt should be aborted.
However, I think we should at least pursue ES6, as X_ITE has done.
John
On Thu, May 7, 2020 at 2:35 AM John Carlson <yottzumm at gmail.com> wrote:
> see app.mjs module for an example of using the ES6 SAI prototype.
> x3d.mjs is the module library. I'm following on x3d.py's lead!
>
> Will integrate X3DJSAIL with Node.js when you provide a list of public
> facing SAI classes beyond X3DUOM.
>
> Code is also here:
>
>
> https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/es6/
>
>
> The main points for using ES6 is classes/modules/export/import.
>
> Thanks,
>
> John
>
> On Thu, Apr 30, 2020 at 9:06 AM John Carlson <yottzumm at gmail.com> wrote:
>
>> Here is another place to pick up the library:
>>
>> http://coderextreme.net/es6.zip
>>
>> I need some examples!
>>
>> Suggest possibly modifying ECMAScript SAI examples.
>>
>> John
>>
>> On Thu, Apr 30, 2020 at 8:53 AM John Carlson <yottzumm at gmail.com> wrote:
>>
>>> Mostly just construction right now. I'm not quite sure how to do
>>> protos. Below is the first example.
>>>
>>> Code is here:
>>> https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/es6 (if
>>> you can access it. I can't right now).
>>>
>>> Comments?
>>>
>>> John
>>>
>>>
>>> $ cat app.mjs
>>> "use strict"
>>>
>>> import X3D from './x3d.mjs';
>>> import { head, meta, Scene, Transform, Group, Material, Shape, Box,
>>> Appearance } from './x3d.mjs';
>>> import { MFNode, SFColor, SFVec3f, SFRotation } from './x3d.mjs';
>>>
>>> var x3d = new X3D({
>>> head : new head({
>>> meta : [
>>> new meta({
>>> name : "John W",
>>> content : "Carlson, I"
>>> }),
>>> new meta({
>>> name : "John A",
>>> content : "Carlson, II"
>>> }),
>>> new meta({
>>> name : "John R",
>>> content : "Carlson, III"
>>> })
>>> ]
>>> }),
>>> Scene : new Scene({
>>> children : new MFNode([
>>> new Group({
>>> children : new MFNode([
>>> new Shape({
>>> appearance : new
>>> Appearance({
>>> material : new
>>> Material({
>>>
>>> diffuseColor : new SFColor([1, 0, 0])
>>> })
>>> }),
>>> geometry : new Box()
>>> })
>>> ])
>>> }),
>>> new Transform({
>>> translation : new SFVec3f([1, 2, 3]),
>>> scale: new SFVec3f([4, 5, 6]),
>>> rotation: new SFRotation([7, 8, 9, 3.14])
>>> })
>>> ])
>>> })
>>> })
>>>
>>> console.log(x3d.toXMLNode());
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200507/06c7b899/attachment.html>
More information about the x3d-public
mailing list