If the regular JavaScript code contains a call to console.log, the message should appear in the Popcode JavaScript console. This means we will need to either replace the console object entirely in the preview environment, or overwrite the log method. For completeness, we might as well handle debug, info, warn, error as well.
We should make sure not to break any other built-in console methods (e.g. console.time()).
I think it makes sense for calls to console.log and friends to still appear in the browser’s JavaScript console—so when we override the built-in functionality, we should hold references to the original methods and call them as well.
If the regular JavaScript code contains a call to
console.log, the message should appear in the Popcode JavaScript console. This means we will need to either replace theconsoleobject entirely in the preview environment, or overwrite thelogmethod. For completeness, we might as well handledebug,info,warn,erroras well.We should make sure not to break any other built-in console methods (e.g.
console.time()).I think it makes sense for calls to
console.logand friends to still appear in the browser’s JavaScript console—so when we override the built-in functionality, we should hold references to the original methods and call them as well.