After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 791111 - Modernise JS usage
Modernise JS usage
Status: RESOLVED FIXED
Product: gnome-devel-docs
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-devel-docs maintainers
gnome-devel-docs maintainers
Depends on:
Blocks:
 
 
Reported: 2017-12-01 23:37 UTC by Florian Müllner
Modified: 2017-12-04 19:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tour: Modernise JS usage (5.13 KB, patch)
2017-12-01 23:37 UTC, Florian Müllner
committed Details | Review
demos: Give JS samples the same treatment (148.36 KB, patch)
2017-12-01 23:37 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2017-12-01 23:37:36 UTC
Javascript has evolved a fair bit since the code samples were written, so update them to reflect what we currently consider best practices.
Comment 1 Florian Müllner 2017-12-01 23:37:43 UTC
Created attachment 364795 [details] [review]
tour: Modernise JS usage

As GJS was updated to use newer SpiderMonkey versions, it is now
possible to use more modern language features and less non-standard
modules such as Lang. Take advantage of that and update the code
examples to follow the recommendations in ptomato's GUADEC talk[0].

[0] https://ptomato.wordpress.com/2017/07/30/modern-javascript-in-gnome-guadec-2017-talk/
Comment 2 Florian Müllner 2017-12-01 23:37:51 UTC
Created attachment 364796 [details] [review]
demos: Give JS samples the same treatment

After updating the tour to use modern javascript patterns and coding
style, go through all provided samples and update them to use arrow
notation, Function.prototype.bind() and ES6 classes.
Comment 3 David King 2017-12-04 15:50:50 UTC
Review of attachment 364795 [details] [review]:

Looks fine to me.
Comment 4 David King 2017-12-04 15:52:23 UTC
Review of attachment 364796 [details] [review]:

Also seems fine.
Comment 5 Florian Müllner 2017-12-04 19:32:34 UTC
Attachment 364795 [details] pushed as 351cbb2 - tour: Modernise JS usage
Attachment 364796 [details] pushed as bc2b4a1 - demos: Give JS samples the same treatment