Skip to content

Commit 24a03e5

Browse files
committed
API updates for PHP7 branch.
1 parent 1464934 commit 24a03e5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/V8Js.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,29 @@ public function __construct($object_name = 'PHP', array $variables = null, array
2020
{}
2121

2222
/**
23-
* Provide a function or method to be used to load required modules.
24-
* This can be any valid PHP callable.
23+
* Provide a function or method to be used to load required modules. This can be any valid PHP callable.
2524
* The loader function will receive the normalised module path and should return Javascript code to be executed.
2625
*
2726
* @param callable $loader
2827
*/
2928
public function setModuleLoader(callable $loader)
3029
{}
3130

31+
/**
32+
* Provide a function or method to be used to normalise module paths. This can be any valid PHP callable.
33+
* This can be used in combination with setModuleLoader to influence normalisation of the module path (which
34+
* is normally done by V8Js itself but can be overriden this way).
35+
*
36+
* The normaliser function will receive the base path of the current module (if any; otherwise an empty string)
37+
* and the literate string provided to the require method and should return an array of two strings (the new
38+
* module base path as well as the normalised name). Both are joined by a '/' and then passed on to the
39+
* module loader (unless the module was cached before).
40+
*
41+
* @param callable $normaliser
42+
*/
43+
public function setModuleNormaliser(callable $normaliser)
44+
{}
45+
3246
/**
3347
* Compiles and executes script in object's context with optional identifier string.
3448
* A time limit (milliseconds) and/or memory limit (bytes) can be provided to restrict execution. These options will throw a V8JsTimeLimitException or V8JsMemoryLimitException.

0 commit comments

Comments
 (0)