Documentation ¶
Index ¶
- Constants
- Variables
- func DisablePrecompile()
- func EnablePrecompile()
- func SetHeapAvailableSize(size uint)
- func Start(option *Option) error
- func Stop()
- type Context
- type Isolate
- type Isolates
- type Option
- type Script
- func Load(file string, id string) (*Script, error)
- func LoadRoot(file string, id string) (*Script, error)
- func LoadWidget(file string, id string) (*Script, error)
- func NewScript(file string, id string, timeout ...time.Duration) *Script
- func Select(id string) (*Script, error)
- func SelectRoot(id string) (*Script, error)
- func SelectWidget(id string) (*Script, error)
Constants ¶
View Source
const ( // IsoReady isolate is ready IsoReady uint8 = 0 // IsoBusy isolate is in used IsoBusy uint8 = 1 )
Variables ¶
View Source
var RootScripts = map[string]*Script{}
RootScripts the scripts for studio
View Source
var Scripts = map[string]*Script{}
Scripts loaded scripts
View Source
var WidgetScripts = map[string]*Script{}
WidgetScripts the scripts for widget
Functions ¶
func SetHeapAvailableSize ¶
func SetHeapAvailableSize(size uint)
SetHeapAvailableSize set runtime Available
Types ¶
type Context ¶
type Context struct { ID string // the script id SID string // set the session id Data map[string]interface{} // set the global data Timeout time.Duration // terminate the execution after this time Iso *Isolate Root bool *v8go.Context }
Context v8 Context
type Option ¶
type Option struct { MinSize int `json:"minSize,omitempty"` // the number of V8 VM when runtime start. max value is 100, the default value is 2 MaxSize int `json:"maxSize,omitempty"` // the maximum of V8 VM should be smaller than minSize, the default value is 10 HeapSizeLimit uint64 `json:"heapSizeLimit,omitempty"` // the isolate heap size limit should be smaller than 1.5G, and the default value is 1518338048 (1.5G) HeapSizeRelease uint64 `json:"heapSizeRelease,omitempty"` // the isolate will be re-created when reaching this value, and the default value is 52428800 (50M) HeapAvailableSize uint64 `json:"heapAvailableSize,omitempty"` // the isolate will be re-created when the available size is smaller than this value, and the default value is 524288000 (500M) Precompile bool `json:"precompile,omitempty"` // if true compile scripts when the VM is created. this will increase the load time, but the script will run faster. the default value is false DataRoot string `json:"dataRoot,omitempty"` // the data root path }
Option runtime option
type Script ¶
Script v8 scripts
func LoadWidget ¶
LoadWidget load the script for custom widgets
func SelectRoot ¶
SelectRoot a script with root privileges
func SelectWidget ¶
SelectWidget a custom widget script
Source Files ¶
Click to show internal directories.
Click to hide internal directories.