Hi Tobias, For widgets that have been created in the usual way, `widget.parseTreeNode.type` will return “browse”, “edit-text”, etc. It’s the technique that is used in the core, for example:
https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/importvariables.js#L62 Best wishes Jeremy. > On 25 Oct 2016, at 13:56, BJ <[email protected]> wrote: > > LinkWidget.prototype.name = "link"; > > then we can access as > > alert(widget.name) > > On Tuesday, October 25, 2016 at 12:44:12 PM UTC+1, Tobias Beer wrote: > Hi BJ, > > we could add a 'type' or name to the object, but at present you would need to > do this: > > Ok, I see. That doesn't look too pretty. > > So, a new "helper" function on the base Widget class would be great, > so the prototype class would have it, > but not every single widget would need to define its name. > > Any idea how to implement that? e.g. > > exports.type = function() { > return ?!?; > } > > Thanks, > > Tobias. > > -- > You received this message because you are subscribed to the Google Groups > "TiddlyWikiDev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/tiddlywikidev > <https://groups.google.com/group/tiddlywikidev>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tiddlywikidev/0770341b-6b5f-4790-972a-616b5c40d4b4%40googlegroups.com > > <https://groups.google.com/d/msgid/tiddlywikidev/0770341b-6b5f-4790-972a-616b5c40d4b4%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywikidev. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/BBA4C855-D1F4-4A4C-9814-09A4225E4F0F%40gmail.com. For more options, visit https://groups.google.com/d/optout.
