Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Has the ECMAScript 6 support increased in the past 2 years?

Found this:&nbsp; <a href="https://app.roll20.net/forum/post/3521847/ecmascript-6/?pageforid=3521847" rel="nofollow">https://app.roll20.net/forum/post/3521847/ecmascript-6/?pageforid=3521847</a> , it's old though, so I want to double check. It looks like I can use classes as long as I'm in strict mode, but have we implemented any of the other features?&nbsp; Specifically destructuring, the spread operator, and rest parameters?
1532620083

Edited 1532620191
Kryx
Pro
Sheet Author
API Scripter
I use ES6 for Shaped, but babel it all to ES5 to support all browsers. Roll20 may support ES6 now, but babel to ES5 is the norm in the web community. Your main concerns would be IE.
1532620713

Edited 1532620792
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Charles H. said: Found this:&nbsp; <a href="https://app.roll20.net/forum/post/3521847/ecmascript-6/?pageforid=3521847" rel="nofollow">https://app.roll20.net/forum/post/3521847/ecmascript-6/?pageforid=3521847</a> , it's old though, so I want to double check. It looks like I can use classes as long as I'm in strict mode, but have we implemented any of the other features?&nbsp; Specifically destructuring, the spread operator, and rest parameters? Can confirm that destructuring and the spread operator work. Not sure on Rest, but it looks like just a specific form of spread so I'd say it's an even bet. We even have ECMA7 support (at least to a degree) as async/await work as well. Note that as with promises, these don't work in character sheets. As for Kryx's recommendation of babeling to ES5, and as nothing more than a tyro who only codes on Roll20, my personal view is that since Roll20 itself only officially supports chrome/firefox extending the support for where scripts/sheets work is a losing proposition.
Awesome, thanks.
1532625352
The Aaron
Pro
API Scripter
The API Sandbox runs on top of Node.&nbsp; I don't remember the specific version, but it's somewhere in the Node 6.4.0-Node 6.14.3 range. Look here:&nbsp; <a href="https://node.green/" rel="nofollow">https://node.green/</a> &nbsp;for what is likely supported. Rest and Spread work in the API with arrays: const myStuff = [...someArray, ...SomeOtherArray]; const someFunc = (...a) =&gt; log(a); But not for Objects: const myStuff = {...someObject, ...SomeOtherObject}; const someOther = {b,...a} = {b: 'foo', s:'bar', e: 'qux'}; Mostly you should be fine with modern JS.&nbsp; I was chatting with one of the devs recently about updating the API, maybe that will happen in the not to distant future.