[Pas2js] Component Streaming implemented

Michael Van Canneyt michael at freepascal.org
Mon Jul 8 07:38:55 CEST 2019



On Sun, 7 Jul 2019, warleyalex via Pas2js wrote:

> When a project have many forms I think it is more efficient load form-data
> inlined JSON data like EWB scheme.

[snip]

> ------------------------
> When you compile the project, the data must be embedded inline at main HTML.
> By giving the JSON data a non-standard type in the 
> -----------
> Note: 
> The type="application/json" is needed to prevent browser from parsing it
> while loading.
> This will work just fine in all browsers.
>
> After that, you can use it in the main script, you can access the form data:
>
> JSON.parse(document.getElementById('TformAccounting').innerHTML);

Or you can put it in a data tag.

>
> When you load a large document, a big project with dozens forms, the larger
> is the benefit.

FPC has a structure where the streaming is not necessarily in a binary
scheme. There is somewhere a reader/writer that uses JSON. There is also one
that uses XML.

So your idea should be easily implemented: the structure is now in place.

Michael.


More information about the Pas2js mailing list