"Hello-Json" plugin for connecting to AWS, Wordpress, etc

With much appreciation for Jeremy and everyone who contributed to 5.3.

I have been meaning to give back by “scrubbing” and sharing client use cases.

It is a very common need for me to pull JSON into TW-- or push JSON out of it. After hacking lots of latch-on JavaScript macros, I distilled some things down and expressed them in a new TW plugin repo called HelloJson.

Basic setup: https://github.com/philwonski/twplugins-hello-json

Advanced usage: https://github.com/philwonski/twplugins-hello-json-advanced

HelloJson allows you to do stuff like this Wordpress example:

<$hellojson command="wpapi" wpaction="getposts" wpsite="http://mydigitalmark.com"/>

So HelloJson can be thought of as an extendable version of the new http-requests widget.

The http widget in 5.3 is a major breakthrough for TiddlyWiki users. This is less about the specifics of a given plugin or widget and more about the conceptual leap: there’s TW as the single-file notebook, and now there is also TW as the frontend JavaScript framework. We have state management, and we have a jsx-alternative in WikiText that’s better than jsx at a lot of stuff. Boom!

All feedback welcome, I hope you improve it and build something cool. I’m especially interested in expanding my knowledge of refresh and render in plugins, and tricks with $tw methods in general.

Cheers,

Phil

2 Likes

Looks fascinating. It’s going to take some time to sink in, though.

But wow, CoffeeScript! It’s been a while since I saw that!

Thank you for sharing! I look forward to playing with this.

1 Like

Haha thanks, Scott! If you check out the demo links in the advanced repo with dev tools open it can help bring it all together.

Like this one:

https://philwonski.github.io/twplugins-hello-json-advanced/#test-hangover

And these:

I knew I would get some chuckles for the CoffeeScript, but I can’t lie I use it all the time, especially for class definitions. In this workflow, it’s almost like the coffee file is a sort of YAML to organize everything that’s to happen in the helpers and the main plugin file.

Happy Wiki-ing