V8 JavaScript Engine 統合

目次

V8Js クラス

はじめに

これは V8Js 拡張モジュールのコアクラスです。 このクラスのインスタンスはそれぞれ個別のコンテキストを持ち、 その中ですべての JavaScript をコンパイルして実行します。

詳細は V8Js::__construct を参照ください。

クラス概要

V8Js
class V8Js {
/* 定数 */
const string V8Js::V8_VERSION;
const int V8Js::FLAG_NONE = 1;
const int V8Js::FLAG_FORCE_ARRAY = 2;
/* メソッド */
public __construct(
    string $object_name = "PHP",
    array $variables = array(),
    array $extensions = array(),
    bool $report_uncaught_exceptions = true
)
public mixed executeString(string $script, string $identifier = "V8Js::executeString()", int $flags = V8Js::FLAG_NONE)
public static array getExtensions()
public V8JsException getPendingException()
public static bool registerExtension(
    string $extension_name,
    string $script,
    array $dependencies = array(),
    bool $auto_enable = false
)
}

定義済み定数

V8Js::V8_VERSION

V8 JavaScript Engine のバージョン。

V8Js::FLAG_NONE

何もフラグが立っていません。

V8Js::FLAG_FORCE_ARRAY

すべての JS オブジェクトを PHP の連想配列にします。

V8JsException クラス

はじめに

クラス概要

V8JsException
class V8JsException extends Exception {
/* プロパティ */
protected $JsFileName;
protected $JsLineNumber;
protected $JsSourceLine;
protected $JsTrace;
/* 継承したプロパティ */
protected string $message = "";
private string $string = "";
protected int $code;
protected string $file = "";
protected int $line;
private array $trace = [];
private Throwablenull $previous = null;
/* メソッド */
final public string getJsFileName()
final public int getJsLineNumber()
final public string getJsSourceLine()
final public string getJsTrace()
/* 継承したメソッド */
final public string Exception::getMessage()
final public Throwablenull Exception::getPrevious()
final public int Exception::getCode()
final public string Exception::getFile()
final public int Exception::getLine()
final public array Exception::getTrace()
final public string Exception::getTraceAsString()
public string Exception::__toString()
private void Exception::__clone()
}

プロパティ

JsFileName

JsLineNumber

JsSourceLine

JsTrace