package
module
Version:
v0.0.0-...-348ad67
Opens a new window with list of versions in this module.
Published: Feb 9, 2023
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
go-js
基于goja封装的一个JavaScript脚本引擎。
最开始是基于otto封装的,可惜它对很多ES5的语法都不支持,用着实在是蛋疼无比。
后来改为goja,goja甚至支持一些ES6的语法。其实,goja是基于otto做的开发,可以说是青出于蓝,更甚于蓝。
基本交互
变量
变量有三种访问方式:
- 单向只写 - 将宿主的变量注入;
- 单向只读 - 读取脚本中的变量;
- 双向可读可写 - 将宿主的变量注入,脚本可操作宿主的变量并且反馈到宿主。
方法
Documentation
¶
func NewVirtualMachine() *virtualMachine
Source Files
¶
Click to show internal directories.
Click to hide internal directories.