From baaf46ec32b715cfad5c4c73b2ad7b347036f99d Mon Sep 17 00:00:00 2001 From: Hauke D Date: Wed, 22 Aug 2018 16:10:59 +0200 Subject: [PATCH 1/4] Allow multiple state change listeners Documentation for a18fd401c541d828530e5eeb52ce801c7e3f8bd5 --- using.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/using.md b/using.md index c74e99c..67f4905 100644 --- a/using.md +++ b/using.md @@ -300,8 +300,26 @@ Defaults to `false`. 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()`. From b7209f81866c783676d3e7b58bee5bbbfb1260fa Mon Sep 17 00:00:00 2001 From: Hauke D Date: Sun, 2 Sep 2018 18:06:04 +0200 Subject: [PATCH 2/4] Added documentation for js_new() haukex/emperl5@a0cc701354a6fb715257017a338f7fa1be5acf85 --- using.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/using.md b/using.md index 67f4905..a9ad921 100644 --- a/using.md +++ b/using.md @@ -344,6 +344,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`. @@ -440,6 +441,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`. + *** From 85a3168cf7e372b7eef673750f78681c0552015e Mon Sep 17 00:00:00 2001 From: Hauke D Date: Sun, 2 Sep 2018 20:28:37 +0200 Subject: [PATCH 3/4] Updated links from v0.03-beta to v0.05-beta --- index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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/ From f98de9b1669fad624095f78d01db3725a6efd737 Mon Sep 17 00:00:00 2001 From: Hauke D Date: Sun, 2 Sep 2018 20:54:34 +0200 Subject: [PATCH 4/4] Documented Perl.noMountIdbfs 62e9b19fe33f4c0ab365c6ba3f1b8fc405cde12a --- using.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/using.md b/using.md index a9ad921..73e6258 100644 --- a/using.md +++ b/using.md @@ -295,6 +295,14 @@ 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