complate / complate-spring-mvc

complate integration for Spring MVC
2 stars 1 forks source link

polyfill `console` #8

Closed FND closed 7 years ago

FND commented 7 years ago

complate is typically used with faucet, which reports compilation errors directly within the bundle:

(typeof alert !== "undefined" ? alert : console.error)("ERROR: SyntaxError: … Unexpected token …");

However, Nashorn currently doesn't support console.error, using print instead (there's no immediate equivalent for stderr AFAIK). Thus, before evaluating JavaScript code, we should prepend the following:

if(typeof console === "undefined") {
    var console = {
        log: print,
        error: print
    };
}

(Note that we're already doing something similar for global.)

dwestheide commented 7 years ago

Fixed by #9 .