CMake 选项

选项模块
BUILD_CONSOLEconsole.*
BUILD_GLOBALglobal.*(parseInt、parseFloat)
BUILD_STRINGstring.*(String.fromCharCode)
BUILD_DATEdate.*
BUILD_JSONjson.*
BUILD_MATHmath.*

运行时绑定

#include "extension/console.h"
#include "extension/global.h"
#include "extension/string.h"
#include "extension/date.h"
#include "extension/math.h"
#include "extension/json.h"

EConsole::bind(js);
EGlobal::bind(js);
EString::bind(js);
EDate::bind(js);
EMath::bind(js);
EJson::bind(js);

console

global

String(全局对象)

Date

默认格式:%Y-%m-%d %H:%i:%s

Math

常量:E, LN10, LN2, LOG10E, LOG2E, PI, SQRT1_2, SQRT2

函数:abs acos acosh asin asinh atan atan2 atanh cbrt ceil clz32 cos cosh exp expm1 f16round floor fround hypot imul log log10 log1p log2 max min pow random round sign sin sinh sqrt sumPrecise tan tanh trunc

JSON

let o = JSON.parse('{"a":1,"b":[2,3]}');
JSON.stringify(o); // {"a":1,"b":[2,3]}
核心数组/字符串方法不依赖扩展模块 — 请参阅 JavaScript 特性