marklovers / kaplay

🦖 A JavaScript game library
https://kaplayjs.com
MIT License
230 stars 14 forks source link

feat: support for custom names in inspect functions #168

Closed amyspark-ng closed 1 week ago

amyspark-ng commented 1 week ago

Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

When creating a custom component you might want to say something instead of the name of the comp, let's say in the drag component, i'd like for it to say "dragging: true" instead of "drag: true" but if i do

inspect() {
    return `dragging: ${this.dragging}` 
}

it will show up as "drag: dragging: true", and that's no good, it should check if the function has an inspect function, and if it does display it, if not do the usual "tag: tag[data]" behaviour