Scripts are quite large due to imposing product functionality. When either first loading a web application or disabled browser caching, the download may take some time, especially if the internet connection is low. We offer two variants of solution this problem: use packed scripts or use a partial functionality and download only what is required.

 

 

Packed Scripts

Packed scripts have the same structure as basic scripts, but they have the *.pack.js ending in the file name. Such scripts contain a block of packed data as a JavaScript variable and a compact unpacker. When loading all scripts, an unpacker automatically unpacks all loaded data and runs a prepared script for execution. The unpacking takes some time, but under certain conditions, for example, when the internet connection is slow time is much more less, than basic scripts load speed.

 

To use packed scripts you should set the $js->packed to true. For example:

 

index.php

 

<head>

<?php

$js = new \Stimulsoft\StiJavaScript(\Stimulsoft\StiComponentType::Report);

$js->usePacked = true;

$js->renderHtml();

?>

</head>

 

 

 

When using the JavaScript code, you should add the ending .pack.js in all Stimulsoft scripts used, for example:

 

index.php

 

<head>

<script src="vendor/stimulsoft/reports-php/scripts/stimulsoft.reports.pack.js" type="text/javascript"></script>

</head>

 

 

 

Partial loading of scripts

The stimulsoft.reports.js script contains all functionality of rendering and exporting reports. If you want to generate reports, you need only some of these capabilities. There is the loading of necessary parts of the generator, which contain a certain set of capabilities. For example, if maps are not used in your reports, you shouldn't load them. This will accelerate web project load and reduce browser memory consumption.

 

Information

 

This capability is implemented only for the report generator engine, viewer and the designer can't be divided into parts, their scripts will be loaded fully by one block.

 

 

 

To use partial scripts loading you should set the required PHP options in code for the StiJavaScript class.

 

index.php

 

<head>

<?php

$js = new \Stimulsoft\StiJavaScript(\Stimulsoft\StiComponentType::Report);

 

$js->options->reports = false;

$js->options->reportsChart = true;

$js->options->reportsExport = true;

$js->options->reportsImportXlsx = true;

$js->options->reportsMaps = true;

 

$js->renderHtml();

?>

</head>

 

 

 

When using the JavaScript code, you should remove the loading of the stimulsoft.reports.js script from the project, and add one or more scripts from the list below:

 

index.php

 

<head>

<script src="vendor/stimulsoft/reports-php/scripts/stimulsoft.reports.engine.js" type="text/javascript"></script>

<script src="vendor/stimulsoft/reports-php/scripts/stimulsoft.reports.export.js" type="text/javascript"></script>

<script src="vendor/stimulsoft/reports-php/scripts/stimulsoft.reports.chart.js" type="text/javascript"></script>

<script src="vendor/stimulsoft/reports-php/scripts/stimulsoft.reports.maps.js" type="text/javascript"></script>

<script src="vendor/stimulsoft/reports-php/scripts/stimulsoft.reports.import.xlsx.js" type="text/javascript"></script>

</head>

 

 

 

Each PHP option of the StiJavaScript object controls the loading of a script containing specific functionality. The table contains the whole set of scripts, which you can load separately.

 

Name

Description

stimulsoft.reports.engine.js

It contains only all what you need to load and render a report, work with data. It's necessary for linking.

stimulsoft.reports.export.js

It contains algorithms to export a rendered report in various formats – PDF, HTML, Excel, RichText and the others.

stimulsoft.reports.chart.js

It contains components for work with all types of charts in a report.

stimulsoft.reports.maps.js

It contains components for work with regional and online maps.

stimulsoft.blockly.editor.js

It contains visual editor Blockly for creating event scripts in a report. The Event handler is embedded in report engine.

stimulsoft.reports.import.xlsx.js

It contains algorithms for work with Excel data sources.

 

Information

 

Connection sequence of any Stimulsoft scripts doesn't matter, so as all scripts have additional checks of postponed loading and the run of necessary modules.