Skip to content

Add a basic console #7

@toolness

Description

@toolness

As @indefinit metioned in processing/p5.js-website#198 (comment), it'd be nice to have some kind of console in the widget. Right now we show the last error that occurred in the "status bar" at the bottom of the widget, but that's it.

We talked a bit about web consoles in a recent p5 working group meeting, and noted a few things about the various web-based tools out there that have consoles:

  • Code that "spams" the console can significantly slow down web-based consoles in ways that they may not slow down built-in browser tools. For example, codepen.io's console just stops working after a lot of stuff has been logged to it. So figuring out workarounds for this might be nice, e.g.:
    • Only keep the latest n console messages, throwing away the older ones, so that the page's DOM doesn't explode in size.
    • If multiple identical console messages are logged consecutively, do what most built-in browser tools do: add a "badge" next to the original console message indicating the number of times it's repeated, rather than adding a whole new row. This is both nicely usable and keeps the DOM footprint nice and small.
  • One of the best things about browser consoles is the ability to log a JS object and interactively explore it in the console. It'd be nice to have this kind of functionality, but it's also rather complicated. One idea I mentioned in the meeting was actually developing a separate console widget that could be reused in multiple projects, including this one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions