Hi Mario and Jeremy,

thanks for your responses. Now that I've adapted Timimi for TWC via plugin 
<https://groups.google.com/forum/#!topic/tiddlywikiclassic/TCuPSb2uMfQ> and 
also created a PR <https://github.com/ibnishak/Timimi/pull/24> to support 
it "natively" by Timimi, I've got more specific questions. First, Mario, 
could you clarify this bit:

tiddlyfox.js ... outdated, but the mechanism is the same
>

what you consider outdated? Do you refer to it being *named* "tiddlyfox.js" 
while it's used for Timimi and TiddlyDesktop which are more up-to-date? Or 
you mean that the *saver design* itself is outdated in some aspect?

Second question is: why all the savers call the callback with null as the 
first (and only) argument? I guess, it's a placeholder for some specific 
design, could somebody clarify it?

Finally, and that's my main current concern, I'd like to discuss the events 
system. The thing is, as far as I can see, "tiddlyfox" saver only relies on 
the tiddlyfox-have-saved-file event fired on successful saving, it doesn't 
listen to any ~tiddlyfox-have-failed-to-save-file event. And hence Timimi 
doesn't implement firing such events. Which is not nice in some cases (say, 
you have a TW on a removable USB storage device, you remove it, then press 
save, and don't get any notification about saving actually failed) and for 
some applications (well, that's needed at least in TWC upgrading engine 
which displays the stage/status of the procedure). So I'd like to propose 
introducing such an event. But since Timimi is designed for TW5 in the 
first place, I'd like to discuss the design of the event with you so that 
Rizwan have a reference and can participate the discussion too.

Now, tiddlyfox-have-failed-to-save-file is definitely not a nice name, 
because TiddlyFox is both outdated and doesn't fire such an event. So it 
should be something more abstract, I think. Like 
tiddlywiki-saver-have-failed-to-save-file or something shorter like 
tiddlywiki-saver-fail. Ideally, such an event should hold some values that 
help identify the cause of a fail (folder doesn't exist, permission denied, 
.., unknown), presumably in a form of some codes (unknown = 0, folder 
doesn't exist = 1, ...) so that localization is possible. A second thought 
is: if such new event is introduced, perhaps new events should be used for 
saving-request and saving-succeeded too (both old and new events should be 
fired for backward compability): I'd propose tiddlyfox-have-saved-file → 
tiddlywiki-saver-success and tiddlyfox-save-file → tiddlywiki-saver-request. 
So that we have:

init saving: tiddlywiki-saver-request (+ tiddlyfox-save-file for backward 
compatibility)
saving succeeded: tiddlywiki-saver-success (+ tiddlyfox-have-saved-file for 
backward compatibility)
saving failed: tiddlywiki-saver-fail

Perhaps an even better choise would be to give names for arbitrary IO 
operations (saving, loading, saving binaries etc) which could be:

init saving: tiddlywiki-backend-save-request (+ tiddlyfox-save-file for 
backward compatibility)
saving succeeded: tiddlywiki-backend-save-success (+ 
tiddlyfox-have-saved-file for backward compatibility)
saving failed: tiddlywiki-backend-save-fail
and can further be extended to things like
tiddlywiki-backend-load-request, -success, -fail
etc

What do you think?

Best regards,
Yakov.

PS1 I think the scope of docs which I proposed in this thread is actually 
"TiddlyWiki interoperability and data formats".

PS2 Besides multiline fields, there's another issue about .tid format, 
namely convention regarding filenames (say, tiddler name contains * which 
is not allowed in filenames – what should be the .tid filename? Obviously, 
the convention should describe a reversible convertion (without 
ambiguities).

среда, 10 апреля 2019 г., 12:37:38 UTC+3 пользователь PMario написал:
>
> On Sunday, March 24, 2019 at 3:58:40 PM UTC+1, Yakov wrote:
> ...
>
>> in the latest release of TiddlyWiki Classic I've fixed the upgrading 
>> engine and now it's time to deal with saving more consistently. That's 
>> where I'd like not only to ask about some dev aspects but also discuss some 
>> conventions and create docs for consistent support of saving both TWC and 
>> TW5.
>>
>
> Some basic info about savers can be found here: 
> https://tiddlywiki.com/dev/#Saver
>
> If you have a closer look at the implementations 
> <https://github.com/Jermolene/TiddlyWiki5/tree/master/core/modules/savers>
>  
>  - tiddlyfox.js ... outdated, but the mechanism is the same.
>  - beaker.js ... new saver using the dat-project
>  - put.js ... WebDav PUT saver. 
>
> IMO this info should be enough to create your own simple saver. ... I 
> think the upload.js used a php server side. 
>
> If a "save action" is triggered, the core uses the saver.canSave() info 
> to check if the saver can be used at all. saver.info() returns the saver 
> capabilities and the priority. 
>
> If several savers are able to provide the needed save action, the saver 
> with the highest priority wins. ... ATM  "There can be only one 
> <https://www.youtube.com/results?search_query=there+can+be+only+one>!"
>
> have fun!
> mario
>

-- 
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/4592137f-a8e6-442f-82fe-f96ab88599e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to