Attempting to run the V8 engine in Google Apps Script
I have a question.
I think the GAS engines are V8 or Rhino, but how should I judge these two?
Also, how can I determine if a code is working in a normal node or in Google Apps Script?
Also, I would like to know how Google Apps Script determines whether calling from Google SpreadSheet is the only way.
There are a few questions, but what do you do with GAS as a way to determine the execution environment?That's what it means.
I've seen a lot of ways to determine whether it's a browser, a Node, or what kind of browser it is, but I didn't see such a code for GAS.
Thank you for your cooperation.
google-apps-script
I looked it up and found out that the information from the official page was all right.
More information can be found in two places:
V8 Runtime Overview | Apps Script | Google Developers
https://developers.google.com/apps-script/guides/v8-runtime
Migrating scripts to the V8 runtime | Apps Script | Google Developers
https://developers.google.com/apps-script/guides/v8-runtime/migration
Most codes are errors on one side and not on the other side, but I didn't want to mix exceptions in the decision process (probably because it's slow), so I thought there would be any difference other than the exception.
It said whether Object.prototype.toSource is present or not.
When I actually moved it
console.log (type of Object.toSource==='undefined')
I understand that this is false in the case of Rhino and true in the case of V8, so I will decide with this.
I think there are other things, but I think this will be easy for now.
This self-made library determines the environment of deno, node.js, browsers, Google AppsScript, etc.Gas itself determines the existence of a global Browser object.
https://github.com/standard-software/partsjs/blob/v6.0.0/source_code/platform/platform.js
We will also soon incorporate the Rhino or V8 decision.
© 2024 OneMinuteCode. All rights reserved.