Hi Richard

Hi Mario - I found the github api and was just reading up on it. I thought
>> it might be a good way for me to learn a bit more about how api calls work.
>>
> I see your point about calling the api repeatedly - what do you think the
>> best practice would be in this regard? ie; is there a way to limit the
>> number of times it gets called (once?) - for example only when the wiki is
>> loaded and store the result?
>>
>
You definitely don't want to be making HTTP calls from macros or widgets;
by the time the call returns the widget/macro might have been destroyed and
recreated by the refresh mechanism.

Here's a potentially workable approach. Issue 1799 has the following URL:

https://github.com/Jermolene/TiddlyWiki5/issues/1799

As a convention, we could store the corresponding title in the text field
system tiddler:

$:/plugins/richardsmith/githubissues/
https://github.com/Jermolene/TiddlyWiki5/issues/1799

Then we need to display an issue we could do so with a transclusion that
falls through to displaying the URL if the title tiddler is missing:

<$transclude
tiddler="""$:/plugins/richardsmith/githubissues/$(issue-url)$""">
$(issue-url)$
</$transclude>

Then we'd need a startup module or daemon that handles `tm-load-url`
messages, with parameters indicating the URL to load and the tiddler to
store the data. The loading would happen asynchronously, triggering a
refresh when the tiddler is eventually loaded. We would probably need to
take steps to avoid the same tiddler being repeatedly loaded (perhaps we
could rely on XMLHttpRequest to observe the incoming HTTP caching headers).

The final part is triggering the loading. That's tricky because we don't
currently have a way of triggering a message when a chunk of content is
displayed; messages are always triggered by external events like clicks or
timers. The easiest way to experiment would be with a JS macro that sends
the `tm-load-url` message when it is rendered.

That's only an outline, I'd be delighted to help with details. The url
loading mechanism is nicely generic, though.

Best wishes

Jeremy.




-- 
Jeremy Ruston
mailto:[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" 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 http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAPKKYJZ%3Dvwc9_5k2-GCm1AENYaB5kw6q%2Bv4BioBaAvKtAevSSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to