[sword-devel] Sword and WebAssembly

Greg Hellings greg.hellings at gmail.com
Tue Nov 17 22:41:06 EST 2020


Oi. That's going to be really ... interesting. Modules aren't particularly
small, though they rarely exceed 6-8 files except in the case of those
biggest image-based modules. You might be best to auto-scan the list of
available languages, and generate a different copy of your app for each
language that Sword offers modules for? And it would just have all the
relevant files for that language already loaded? It's going to cut down on
one of the great parts of Sword apps, and that's access to *all the
languages*. But if you include *all the languages* even just form CrossWire
and only the ones whose licenses are free to distribute (not all of them
are free for others to distribute, some are CW-only, etc), you're going to
be looking at a good sized application. You can easily grow to dozens of
gigabytes even just picking up a few modules from a few of the more popular
languages. And that's to say nothing of commentaries, lexica, and general
book modules which can balloon quickly in size.

And the user will need to download it *every time*. You might be better off
to have them load the files once, import the content into the Web database
on the host, and just ask for user permission to store lots of data.

A third alternative is to incorporate WebAssembly to fetch Sword files and
write them to local disk using the newly available
https://web.dev/file-system-access/. Requires newer browsers, but you're
not likely running on antique hardware if you're running a browser new
enough for WASM+Qt applications.

You'll mainly be looking into the FileMgr class in Sword for where file
access is.

CLucene is an optional library that is used to build indexes to modules to
speed up searching. It's entirely optional. libsword already includes
brute-force searching that's "good enough" for nearly everyone and "fast
enough" on any remotely modern machine to do the trick. CLucene is
nice-to-have, especially if you know the advanced Lucene search syntax or
if you have an older system with slow access. But it's definitely an
advanced, optional feature.

--Greg

On Tue, Nov 17, 2020 at 9:27 PM Loren Burkholder <
computersemiexpert at outlook.com> wrote:

> Thanks for the suggestions, Greg. One positive thing for me is that I am
> using Qt, and Qt has a macro Q_OS_WASM that is defined when you are
> building for WASM. I'm planning to use this, if necessary, to circumvent
> WASM limitations by removing/rethinking features when in WASM. Also,
> settings that require program reloads are not (in my experience) stored
> between loads of the WASM app. Therefore, the Q_OS_WASM macro could be used
> to simply cut such features from the WASM build.
>
> One thing to consider, as far as modules are concerned, is that if
> somebody is using the WebAssembly build of a program, they almost certainly
> will have a working internet connection at some point. This could mean that
> the program could simply download a basic module--like KJV--at startup, and
> give the user the option to download others straight from the web.
> Alternatively, embedded resources work just fine in WASM (that's how I've
> been delivering the Bible in my app up until now), so the KJV module could
> be embedded with the option to install others.
>
> About CLucene--is that something that is used in Sword by default or is it
> an optional feature?
>
> Loren
>
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://crosswire.org/pipermail/sword-devel/attachments/20201117/1bdf2de4/attachment.html>


More information about the sword-devel mailing list