diff --git a/index.md b/index.md index 280cbf8..193c5ed 100644 --- a/index.md +++ b/index.md @@ -33,7 +33,7 @@ js('document')->getElementById('my_button') ``` -- [**Download `webperl_prebuilt_v0.03-beta.zip`**](https://github.com/haukex/webperl/releases/download/v0.03-beta/webperl_prebuilt_v0.03-beta.zip) +- [**Download `webperl_prebuilt_v0.05-beta.zip`**](https://github.com/haukex/webperl/releases/download/v0.05-beta/webperl_prebuilt_v0.05-beta.zip) - [**Get the sources on GitHub**](https://github.com/haukex/webperl) @@ -46,9 +46,9 @@ Quick Start - In a shell: - $ wget https://github.com/haukex/webperl/releases/download/v0.03-beta/webperl_prebuilt_v0.03-beta.zip - $ unzip webperl_prebuilt_v0.03-beta.zip - $ cd webperl_prebuilt_v0.03-beta + $ wget https://github.com/haukex/webperl/releases/download/v0.05-beta/webperl_prebuilt_v0.05-beta.zip + $ unzip webperl_prebuilt_v0.05-beta.zip + $ cd webperl_prebuilt_v0.05-beta $ plackup webperl.psgi HTTP::Server::PSGI: Accepting connections at http://0:5000/ diff --git a/using.md b/using.md index cc35178..56c4958 100644 --- a/using.md +++ b/using.md @@ -352,13 +352,39 @@ discussion under ["The Perl Interpreter and its Environment"](#the-perl-interpreter-and-its-environment). Defaults to `false`. +#### `Perl.noMountIdbfs` + +If set to `true` before calling `Perl.start()`, then WebPerl will not automatically +mount the IDBFS filesystem (see ["Virtual File System"](#virtual-file-system). +Defaults to `false`. + +This option was added in `v0.05-beta`. + #### `Perl.trace` Enable this option at any time to get additional trace-level output to `console.debug()`. Defaults to `false`. +#### `Perl.addStateChangeListener` + +**Added in `v0.05-beta`.** + +Pass this function a `function (from,to) {...}` to register a new handler +for state changes of the Perl interpreter. + +The states currently are: + +- `"Uninitialized"` - `Perl.init` has not been called yet. +- `"Initializing"` - `Perl.init` is currently operating. +- `"Ready" - `Perl.init` is finished and `Perl.start` can be called. +- `"Running"` - The Perl interpreter is running, `Perl.eval` and `Perl.end` may be called +- `"Ended"` - The Perl interpreter has ended. You might receive several + state change notifications for this state. + #### `Perl.stateChanged` +**Deprecated in `v0.05-beta`.** Use `Perl.addStateChangeListener` instead. + Set this to a `function (from,to) {...}` to handle state changes of the Perl interpreter. Defaults to a simple implementation that logs via `console.debug()`. @@ -383,6 +409,7 @@ It also provides the functions `unregister`, `sub_once`, and `sub1` in ["Memory Management and Anonymous `sub`s"](#memory-management-and-anonymous-subs). For convenience, it can also re-export `encode_json`, so you can request it directly from `WebPerl` instead of needing to `use` another module. +Additional functions, like `js_new()`, are documented below. All functions are exported only on request. Note that WebPerl will also enable autoflush for `STDOUT`. @@ -479,6 +506,21 @@ future be extended to return more than that, similar to `WebPerl::js()`, and then the passing of Perl values to JavaScript could be accomplished differently as well. +### `js_new()` + +This function is a convenience function for calling JavaScript's `new`. +The first argument is the name of the class, the following arguments are +passed to the constructor. It returns the same thing as the `js()` function, +in this case that would be the new object. For example: + + js_new('Blob', [""], {type=>"text/html;charset=utf-8"}) + +is the same as calling this in JavaScript: + + new Blob([""], {type:"text/html;charset=utf-8"}) + +This function was added in WebPerl `v0.05-beta`. + The Mini IDE ------------