You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PEB does not impose execution timeout on any Perl scripts.
157
157
158
158
## Noninteractive Perl Scripts
@@ -176,21 +176,21 @@ They can not receive any user input once they are started and they are divided i
176
176
There is no special naming convention for noninteractive scripts. They can be called from hyperlinks or HTML forms using a full HTTP URL with the PEB pseudo-domain or a relative path. If a relative path is used, the PEB pseudo-domain will be added automatically. The following code is an example of a POST request to a local Perl script from an HTML form with no use of JavaScript:
PEB interactive Perl scripts have their own event loops waiting constantly for new data on STDIN and that allows them to have bidirectional connection with PEB. There can be many interactive scripts per browser window, but each of them must have an unique file name. Interactive scripts must be started with the special pseudo-user ``interactive`` and with the query string items ``target``, ``close_command`` and ``close_confirmation``.
188
188
189
-
The pseudo-user ``interactive`` is the token used by PEB to distinguish between interactive and all other scripts.
189
+
The pseudo-user ``interactive`` is the token used by PEB to detect interactive scripts.
190
190
191
191
The ``target`` query string item should point to a valid HTML DOM element or to a valid JavaScript function. Every piece of script output is inserted immediately into the target DOM element of the calling page or passed to the specified JavaScript function as its first and only function argument. The calling page must not be reloaded during the script execution or no script output will be inserted.
192
192
193
-
The ``close_command`` query string item should contain the command used to initiate the shutdown sequence of the interactive script when the containing PEB window is going to be closed. Upon receiving it, the interactive script must start its shutdown procedure. Immediately before exiting the interactive script must print on STDOUT its ``close_confirmation`` to signal PEB that it completed normally its shutdown. If PEB receives no ``close_confirmation`` in 5 seconds, it will kill the process of the interactive script.
193
+
The ``close_command`` query string item designates the command used to shut down an interactive script when the containing PEB window is going to be closed. Upon receiving it, the interactive script must start its shutdown procedure. Immediately before exiting the interactive script must print on STDOUT its ``close_confirmation`` to signal PEB that it completed normally its shutdown. If PEB receives no ``close_confirmation``from all interactive scripts in the window that is going to be closed in 5 seconds, it will kill the processes of all unresponsive interactive scripts.
194
194
195
195
The following JavaScript code demonstartes how to start an interactive Perl script immediately after its calling HTML page is loaded:
196
196
@@ -251,10 +251,10 @@ PEB is designed to run from any directory without setting anything beforehand an
251
251
Data directory is not hard-coded in C++ code, but a separation of data files from code is generally a good practice. Data directory should contain any SQLite or flat file database or other data files, that a PEB-based application is going to use or produce. The recommended path for data directory is inside the ``{PEB_binary_directory}/resources`` directory. ``data`` is a good directory name, although not mandatory. Perl scripts can access this folder using the following code:
Using the following code any local HTML page can have custom labels on the default right-click context menu (if the ``contextmenu`` event is not already intercepted):
messageBoxElementsObject.noLabel="Custom No Label";
314
314
315
-
returnJSON.stringify(messageBoxElementsObject);
316
-
}
315
+
returnJSON.stringify(messageBoxElementsObject);
316
+
}
317
317
```
318
318
319
319
***Warning for unsaved user input before closing a window:**
@@ -333,20 +333,20 @@ They have two functions:
333
333
The following code is an example of both synchronous and asynchronous warning functions. It is expected that one of them will be present in a PEB-based application where user data is to be protected against accidental loss. If both functions are present, the asynchronous one will take precedence. The asynchronous function in the example code is implemented using [Alertify.js](http://alertifyjs.com/).
334
334
335
335
```javascript
336
-
functionpebCloseConfirmationSync() {
337
-
var confirmation =confirm("Are you sure you want to close the window?");
0 commit comments