Apps Script公式リファレンス: Apps Script Reference |障害・課題追跡: IssueTracker |Google Workspace: Status Dashboard - Summary

2020年2月7日金曜日

GASでアロー関数などが使えるようになった


Release Notes
https://developers.google.com/apps-script/releases#february_5_2020


V8 syntax examples に記載されているリストによると
  • let and const
  • Arrow functions
  • Classes
  • Destructuring assignments
  • Template literals
  • Default parameters
  • Multi-line strings
などが使えるらしい。


手順は簡単で

プロジェクトを開くとこのような表示が出る。(アカウントによってはまだ出ない)
「Enable」をクリックするだけ。



戻したい場合

Run メニューから戻すこともできる
 Run > Disable new Apps Script runtime powered by Chrome V8




既存のRhino runtimeとV8 runtimeの非互換性によって、移行後に既存のコードが失敗する可能性もあるらしい。(ほぼ大丈夫っぽいけど)

https://developers.google.com/apps-script/guides/v8-runtime/migration

失敗したら修正しよう。


参考

https://developers.google.com/apps-script/releases
February 5, 2020
Apps Script now supports the V8 runtime. This enables modern JavaScript features and syntax in Apps Script. You can migrate existing scripts to use V8 and its features.
V8 Runtime Overview
https://developers.google.com/apps-script/guides/v8-runtime

Migrating scripts to the V8 runtime
https://developers.google.com/apps-script/guides/v8-runtime/migration

V8 syntax examples
https://developers.google.com/apps-script/guides/v8-runtime#v8_syntax_examples

Modern JavaScript features
https://developers.google.com/apps-script/guides/services/#modern_javascript_features
The V8 runtime supports modern ECMAScript syntax and features. The Rhino runtime is based on the older JavaScript 1.6 standard, plus a few features from 1.7 and 1.8. You can freely choose which runtime to use with your script, but the V8 runtime is strongly recommended.

Latest post

Google Apps Scriptの障害時はIssueTrackerを見てみる - Incidents for Apps Script are reported on Issue Tracker

IssueTracker > Apps Script issues https://issuetracker.google.com/savedsearches/566234 Google Apps Scriptの障害時は IssueTracker に課題が上がっていることが...