Unable to use available console functions with current interface
There are several useful console functions available that I'm unable to use when developing a plugin, because the TypeScript interface is too limited.
assert()count()countReset()group()groupCollapsed()groupEnd()table()time()timeEnd()timeLog()
The current interface only declares a subset of available functions.
interface Console {
log(message?: any, ...optionalParams: any[]): void
error(message?: any, ...optionalParams: any[]): void
assert(condition?: boolean, message?: string, ...data: any[]): void
info(message?: any, ...optionalParams: any[]): void
warn(message?: any, ...optionalParams: any[]): void
clear(): void
}
FYI: I'm not familiar enough with TypeScript to know if there's a way around this.
Ah, this is because we run plugin code in a javascript VM (here's a link to our blog post about it if you want to learn more!), so we have to overwrite console calls from inside the VM to actually print in the browser. We haven't overwritten these new methods, which is why you can't use them. I'll add this internally as a feature request. Thanks for the feedback!
Ah, this is because we run plugin code in a javascript VM (here's a link to our blog post about it if you want to learn more!), so we have to overwrite
consolecalls from inside the VM to actually print in the browser. We haven't overwritten these new methods, which is why you can't use them. I'll add this internally as a feature request. Thanks for the feedback!
Thanks for clarifying! I'm pretty new to plugin dev, so I was unaware of this. I wonder if it might help future noobs like myself if the interface were named something like VMConsole just to clarify that it's not an interface for the native console.
Thanks for the thoughts here. We've got the feature request, so I'm going to close the issue.