What is the JavaScript execution context of the pa...
# suitecommerce
c
What is the JavaScript execution context of the pageGenerator tool? I find that things which work well in the browser don't work at all in the pageGenerator.
s
Well, there are a few special things about it, such as the fact that you shouldn't use things like
window
, but you shouldn't notice widespread issues.
In that example, we would recommend using
nsglobal
or
Backbone
. Don't forget that you can prevent code from running in the page generator context by using
SC.isPageGenerator() === false
c
I have a 3rd party lib, loaded externally, which uses
const
, and fails. Other than downloading the lib and switching it to ES5, are there other options?
s
I think we have plans to upgrade the supported versions of ECMAScript in the page generator in the near future, but no guarantees. But yes, you can either transpile it to an older version or simply tell the page generator not to load them
c
10-4, Ty @Steve Goldberg. Clarity here is the best solution.