Brief Instructions ...
All these files go in one directory under configuration/scripts/modualibraries
... any directory there will do, it doesn’t have to be called moduaibraries
(See notes below for descriptions)
phpjs.namespaced.mod
helper_PhpJs.mod
helper_twPan.mod
mod_general.js
mod_reload.js
There is a zip of the latest versions available at:
Coming soon!
The basic set up will happen on TeXworks startup. The necessary files are pre loaded i to global objects. This is done as otherwise if read access has not been turned on by the User, subsequent scripts would not be able to load the libraries.
During a Tw session, if you alter and need to re- initialise, from your script sub-menu run the mod_reload.js script (Menu item: Re-load Globals) to load the altered libraries (the current short cut for doing that would be Alt+R Alt+L if you have not already used that combination for something else).
For any script that you wish to use the constants and object functions found in twPan, set it up in this way,
eval(TW.app.getGlobal("helper_twPan"));
This will create twConst and msgBox, and twPan with all of its members for use.
Then Try
twPan.alert('Hi');
var response = twPan.confirm("Do You Want That");
twPan.alert("User Happy: " + response);
var chosen = twPan.select(Please Choose One", ["One","Two","Three"]);
twPan.alert("User Chose: " + chosen);
And in any script you (also) wish to use the functionality of PhpJs (scores of predefined functions) set it up in this way,
eval(TW.app.getGlobal("helper_PhpJs"));
This will create PhpJs and all its members for use. See PhpJs Function List
Either helper object () can be used with, or with out the other. They are independent of each other.
Notes:
phpjs.namespaced.mod (exposes JavaScript versions of numerous php array, string handling, and other functions)
Libarary Files:
phpjs.namespaced.mod (object source)
helper_PhpJs.mod (loader)
helper_twPan.mod (object source and loader)
Hook Script:
mod_general.js (establishes .mod files on Tw startup as application wide globals available to any script)
Stand Alone Script:
mod_reload.js (re-establishes edited .mod files as application wide globals available to any script)
At Application startup the necessary modules will be pre-loaded automatically.
Whenever during your current Tw session you change any of phpjs.namespaced.mod, helper_twPan.mod, helper_PhpJs.mod or any you have added to mod_general.js or mod_reload.js, run the mod_reload.js script to reload the altered libraries (the current short cut for doing that would be Alt+R Alt+L if you have not already used that combination).
Unless you are introducing new or improved functionality to phpjs.namespaced.mod you will probably be leaving it alone.
helper_PhpJs.mod is used to load phpjs.namespaced.mod and create the necessary helper object PhpJs.
helper_twPan.mod has everything it needs in the one file, and when evaluated it creates the twPan helper object and various constant objects, and functions.
twConst
These will be added to as releveant constants grow in the Tw api. Preently the following are incorporated and relate to the C++ code.
SystemAccess_OK : 0,
SystemAccess_Failed : 1,
SystemAccess_PermissionDenied : 2
msgBox
twPan
Created with the Personal Edition of HelpNDoc: Free PDF documentation generator