[texworks] Scripting: Libraries: FYI - compilation of equivalent PHP functions for Qt/JavaScript

Paul A Norman paul.a.norman at gmail.com
Fri Oct 22 13:03:58 CEST 2010

P.S should have mentioned that this library  also comes in a commonJs version.

CommonJs considerations may be something for us to keep in mind for QtScript?

"CommonJS - JavaScript is a powerful object oriented language with
some of the fastest dynamic language interpreters around. The official
JavaScript specification defines APIs for some objects that are useful
for building browser-based applications. However, the spec does not
define a standard library that is useful for building a broader range
of applications.

"The CommonJS API will fill that gap by defining APIs that handle many
common application needs, ultimately providing a standard library as
rich as those of Python, Ruby and Java. The intention is that an
application developer will be able to write an application using the
CommonJS APIs and then run that application across different
JavaScript interpreters and host environments. With CommonJS-compliant
systems, you can use JavaScript to write:

"Server-side JavaScript applications
Command line tools
Desktop GUI-based applications
Hybrid applications (Titanium, Adobe AIR)





On 22 October 2010 17:43, Paul A Norman <paul.a.norman at gmail.com> wrote:
> Hi,  FYI,
>      "Use PHP functions in JavaScript"
>  http://phpjs.org/pages/home
> Some very clever fellows have ported a considerable number of string
> handling, array handling and other potentially very useful functions
> across from php to EMCA style scripting, and made them all work as per
> the PHP manual (documentation as it already exists).
>  http://phpjs.org/functions/index
> (I was thinking these may be useful for Qt scripting? There are of
> course many things that would never be used - and perhaps a core set
> of things we could tie into the TwApi perhaps thorugh a wrapper? like
> a specialized  file_get_contents()  etc ...
> As said there would be many things that are too web orientated and
> would never be used. And some stuff that wold be directly useful now.)
> Even more cleverly they have made their 'library' customisable
> pre-download so that a script-developer could define their own
> package(s) as needed, with only QtScript relevant functions and
> dependencies in it.
>  http://phpjs.org/packages/configure
> Food for thought.
> Paul
> ---- Quote from web site: ----
> "Use PHP functions in JavaScript"
> "php.js
> "php.js is an open source project that brings high-level PHP functions
> to low-level JavaScript platforms such as web browsers, browser
> extensions ( Mozilla/Firefox, Chrome ), AIR, and SSJS engines like V8
> ( node.js, v8cgi ), Rhino, and SpiderMonkey ( CouchDB )
> "If you want to perform high-level operations on these platforms, you
> probably need to write JS that combines its lower-level functions and
> build it up until you have something useful like: strip_tags(),
> strtotime(), number_format(), wordwrap().
> "That's what we are doing for you.
> "Pure JavaScript so no additional components required

More information about the texworks mailing list