[syncadaptor] Default Behavior with Multiple Sync Adapters?

29 views
Skip to first unread message

Charles

unread,
Jul 3, 2020, 6:12:37 PM7/3/20
to TiddlyWikiDev
Hi all,

I was wondering what happens when TiddlyWiki contains more than one syncadaptor? How does TiddlyWiki resolve this? Is there a way to delegate to specific syncadaptors?

The dev post on SyncAdaptor did not seem to indicate a specific policy: https://tiddlywiki.com/dev/#Syncadaptor

My use case: I am trying to reduce my index.html build hosted on my Github.io website by fetching individual Tiddlers from Github.io dynamically rather than baking everything into the html file. I've thought to create a new syncadaptor to fetch the tiddlers for me.

Thanks,
Charles

rdh...@gmail.com

unread,
Jul 3, 2020, 7:15:08 PM7/3/20
to TiddlyWikiDev
Hi Charles,

I believe that if a wiki has more than one syncadaptor, the first one to define an "adaptorClass" is used as the sync adaptor for the syncer.  "First" here seems to be dependent on JavaScript key iteration order, which (as far as I know) is implementation-specific and can't be relied upon.  So it's probably a good idea to have a single sync adaptor, or at least have a list of sync adaptors, each of which will only work in a single environment (for example, the filesystem adaptor only works under Node, and the tiddlyweb adaptor only works in the browser).

I'm wondering if there's a way you could write a startup module that runs before the syncer is set up in startup.js that would set up a special sync adaptor that would delegate to a list of other sync adaptors in a defined/predictable order.  That could be really useful!

-Rob
Reply all
Reply to author
Forward
0 new messages