Descending into JavaScript objects sent as part of event details in EventCatcherWidget

Hi folks,

I have a project where I’d like to get values out of a keyed object that’s passed to event-detail-foo. Using the ActionLogWidget, the debug description is simply [object Object].

It seems like this ought to be possible with jsonindexes and friends (at least for simple JSON-codable types), but jsonindexes on my event-detail-foo seems to return an empty string.

Is there a TiddlyWiki-native way to access the values associated with a JavaScript object? If not, how might someone accomplish this in a Wiki?

Don’t think so. jsonindexes works with strings, not raw JavaScript objects.

You could petition @jeremyruston to add something like jsonindexes:rawobject[].

Not exactly ideal, I know, but you could write a JavaScript macro to return JSON.stringify(event.foo);

What is it in the event object you need access to?

EDIT: maybe @saqimtiaz has some insigth/thoughts.

I’m integrating an external JavaScript library (A-Frame) that sends information in the data of posted events. To get the clicked object (not a DOM object), I need access to event-detail-intersection (which is [object Object] without some way to descend into it).

I tried writing a JavaScript macro, but it doesn’t seem to execute in my wiki. Do I need to change a setting to allow it to run? Or is the another way to extract the data out of the event?

Add a field on the js tiddler, module-type, set it to macro.
Set Type to application/javascript
Then reload your wiki.

Don’t forget this! I spent an hour yesterday trying to figure out why something didn’t work… only to realize that I wasn’t saving after changing a JS module.

Awesome - this worked! Cool that it’s easy to extend TiddlyWiki with some JS. It’d be cool to someday do this in Wikitext, but I’m glad to have a solution.

@Scott_Sauyet - good reminder. The process slows iteration (as you have to reload), but it’s possible.