jsgo

package module
v0.0.0-...-3d7c0ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

README

JSGO

JavaScript run in golang to provide dynamic apis

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OnOutput func(string) = nil
View Source
var OnSendMessage func(string, uint64, interface{}) int = nil
View Source
var OnSendMessageTo func(interface{}) int = nil

Functions

func CallApi

func CallApi(vm C.VMPtr, data *C.char) *C.char

func Dispose

func Dispose()

func DoHandleNoPermission

func DoHandleNoPermission(param map[string]string) (string, error)

func DoInVm

func DoInVm(js string, param string) (int, string, error)

func GetVmNum

func GetVmNum(js string, count int) int

func GoHandle

func GoHandle(vm C.VMPtr, data *C.char) *C.char

func GoOutput

func GoOutput(c *C.char)

func HttpGet

func HttpGet(vm C.VMPtr, data *C.char) *C.char

func HttpPost

func HttpPost(vm C.VMPtr, url *C.char, ct *C.char, data *C.char) *C.char

func Init

func Init(initcount int)

* load js files from ./jsplugin *

func LoadAllJsFile

func LoadAllJsFile(cvm VM, pathname string) string

func ReadAll

func ReadAll(filePth string) ([]byte, error)

func ResetVm

func ResetVm(id int) error

func V8Init

func V8Init() int

func Version

func Version() string

Types

type V8VM

type V8VM struct {
	// contains filtered or unexported fields
}

func (*V8VM) Called

func (vm *V8VM) Called() int64

func (*V8VM) DispatchEnter

func (vm *V8VM) DispatchEnter(sessionId uint64, addr string) int

func (*V8VM) DispatchLeave

func (vm *V8VM) DispatchLeave(sessionId uint64, addr string) int

func (*V8VM) DispatchMessage

func (vm *V8VM) DispatchMessage(sessionId uint64, msg map[interface{}]interface{}) int

func (*V8VM) Dispose

func (vm *V8VM) Dispose()

func (*V8VM) Eval

func (vm *V8VM) Eval(js string) (string, error)

func (*V8VM) GetAssociatedSourceAddr

func (vm *V8VM) GetAssociatedSourceAddr() string

func (*V8VM) GetAssociatedSourceId

func (vm *V8VM) GetAssociatedSourceId() uint64

func (*V8VM) Load

func (vm *V8VM) Load(path string) (bool, string)

func (*V8VM) PrintMemStat

func (vm *V8VM) PrintMemStat()

func (*V8VM) Reset

func (vm *V8VM) Reset()

func (*V8VM) SetAssociatedSourceAddr

func (vm *V8VM) SetAssociatedSourceAddr(addr string)

func (*V8VM) SetAssociatedSourceId

func (vm *V8VM) SetAssociatedSourceId(id uint64)

type VM

type VM interface {
	Dispose()
	Called() int64
	Reset()
	PrintMemStat()
	Load(path string) (bool, string)
	Eval(path string) (string, error)
	SetAssociatedSourceAddr(addr string)
	SetAssociatedSourceId(id uint64)
	GetAssociatedSourceAddr() string
	GetAssociatedSourceId() uint64
	DispatchEnter(sessionId uint64, addr string) int
	DispatchLeave(sessionId uint64, addr string) int
	DispatchMessage(sessionId uint64, msg map[interface{}]interface{}) int
}

func CreateV8VM

func CreateV8VM() VM

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL