we could add a 'type' or name to the object, but at present you would need
to do this:
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Information about this macro
*/
exports.name = "widgets";
exports.params = [
];
/*
Run the macro
*/
exports.run = function() {
var returns = "";
var Widget = require("$:/core/modules/widgets/link.js").link;
var widget = new Widget(); console.log(widget);
for (var widgets in widget.widgetClasses) {
if (widget instanceof widget.widgetClasses[widgets] && widgets!="widget")
returns = widgets;
}
return returns;
}
})();
On Tuesday, October 25, 2016 at 5:35:12 AM UTC+1, Tobias Beer wrote:
>
> Hi BJ,
>
> I know these hold all the widget names, but if I have a reference to a
> single widget object / instance, how do I know its name / type / class /
> prototype, whichever term best suits what I'm trying to read via js?
>
> Maybe I'm just not seeing it. I want to read some property or call some
> function which will return "*LinkWidget*" or just "*link*" if I do
> *someWidgetFoo.type* or *someWidgetFoo.getType()* or the likes.
>
> Best wishes,
>
> 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].
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/494be26f-1079-4422-b502-7436ddd994dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.