Documentation ¶
Index ¶
- Constants
- func IsKernelFile(filesystem afero.Fs, name string) bool
- type Any
- type ApiProviderBinder
- type Bundle
- type BundleFilesystemConfig
- type BundleStatus
- type Callable
- type CompositeFs
- func (c *CompositeFs) Chmod(name string, mode os.FileMode) error
- func (c *CompositeFs) Chown(name string, uid int, gid int) error
- func (c *CompositeFs) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (c *CompositeFs) Create(name string) (afero.File, error)
- func (c *CompositeFs) Mkdir(name string, perm os.FileMode) error
- func (c *CompositeFs) MkdirAll(path string, perm os.FileMode) error
- func (c *CompositeFs) Mount(mount afero.Fs, path string) error
- func (c *CompositeFs) Name() string
- func (c *CompositeFs) Open(name string) (afero.File, error)
- func (c *CompositeFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)
- func (c *CompositeFs) Remove(name string) error
- func (c *CompositeFs) RemoveAll(path string) error
- func (c *CompositeFs) Rename(oldname, newname string) error
- func (c *CompositeFs) Stat(name string) (os.FileInfo, error)
- type FunctionCall
- type Getter
- type GoFunction
- type Kernel
- type KernelConfig
- type KernelModule
- type KernelModuleBinder
- type KernelSyscall
- type KeyManager
- type Module
- type NativeFunction
- type Object
- type ObjectBinder
- type ObjectBuilder
- type ObjectCreator
- type Origin
- type Position
- type PropertyDescriptor
- type PropertyFlag
- type ResourceLoader
- type Sandbox
- type Script
- type SecurityInterceptor
- type Setter
- type StackFrame
- type Value
Constants ¶
View Source
const ( KernelVfsAppsPath = "/kernel/apps" KernelVfsCachePath = "/kernel/cache" KernelVfsTypesPath = "/kernel/@types" KernelVfsWritablePath = "/kernel/data" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApiProviderBinder ¶
type ApiProviderBinder func(kernel Bundle, bundle Bundle, builder ObjectCreator)
type Bundle ¶
type Bundle interface { ID() string Name() string Privileged() bool Privileges() []string SecurityInterceptor() SecurityInterceptor Export(value Value, target interface{}) error Status() BundleStatus Filesystem() afero.Fs Null() Value Undefined() Value NewObjectBuilder(objectName string) ObjectCreator NewObject() Object NewException(err error) Object ToValue(value interface{}) Value FreezeObject(object Object) DeepFreezeObject(object Object) NewTypeError(args ...interface{}) Value Sandbox() Sandbox // contains filtered or unexported methods }
type BundleFilesystemConfig ¶
type BundleStatus ¶
type BundleStatus int
const ( BundleStatusStopped BundleStatus = iota BundleStatusStarted BundleStatusStarting BundleStatusStopping BundleStatusDownloading BundleStatusUpdating BundleStatusFailed BundleStatusInstalled )
func (BundleStatus) String ¶
func (b BundleStatus) String() string
type CompositeFs ¶
type CompositeFs struct {
// contains filtered or unexported fields
}
func NewCompositeFs ¶
func NewCompositeFs(base afero.Fs) *CompositeFs
func (*CompositeFs) Chown ¶
func (c *CompositeFs) Chown(name string, uid int, gid int) error
Chown implements afero.Fs.
func (*CompositeFs) Name ¶
func (c *CompositeFs) Name() string
func (*CompositeFs) Remove ¶
func (c *CompositeFs) Remove(name string) error
func (*CompositeFs) RemoveAll ¶
func (c *CompositeFs) RemoveAll(path string) error
func (*CompositeFs) Rename ¶
func (c *CompositeFs) Rename(oldname, newname string) error
type FunctionCall ¶
func (FunctionCall) Argument ¶
func (f FunctionCall) Argument(idx int) Value
type GoFunction ¶
type GoFunction interface{}
type Kernel ¶
type Kernel interface { Bundle // Start starts the kernel after all KernelModules by executing // the given JavaScript (*.js) or TypeScript (*.ts) file path, // which is relative to the kernel virtual filesystem base. Start(entryPoint string) error // Stop stops the kernel. No further scripts will be executed // after this point. Stop() error }
Kernel is the root Bundle implementation and has special privileges. Also the kernel provides access to all native APIs provided by either builtin modules or loaded external kernel module plugins.
func New ¶
func New(kernelConfig KernelConfig) (Kernel, error)
type KernelConfig ¶
type KernelConfig struct { NewKernelFilesystem func(baseFilesystem afero.Fs) (afero.Fs, error) NewBundleFilesystem func(bundleFilesystemConfig BundleFilesystemConfig) (afero.Fs, error) NewSandbox func(bundle Bundle) Sandbox KernelModules []KernelModule BundleApiProviders []ApiProviderBinder }
type KernelModule ¶
type KernelModule interface { ID() string Name() string SecurityInterceptor() SecurityInterceptor KernelModuleBinder() KernelModuleBinder }
type KernelModuleBinder ¶
type KernelModuleBinder func(bundle Bundle, builder ObjectBuilder)
type KernelSyscall ¶
type KernelSyscall func(caller Bundle) interface{}
type KeyManager ¶
type NativeFunction ¶
type NativeFunction func(call FunctionCall) Value
type Object ¶
type Object interface { Value Get(name string) Value PropertyDescriptor(name string) PropertyDescriptor Freeze() Object DeepFreeze() Object DefineFunction(functionName, propertyName string, function NativeFunction) Object DefineGoFunction(functionName, propertyName string, function GoFunction) Object DefineConstant(constantName string, value interface{}) Object DefineSimpleProperty(propertyName string, value interface{}) Object DefineObjectProperty(objectName string, objectBinder ObjectBinder) Object DefineAccessorProperty(propertyName string, getter Getter, setter Setter) Object }
type ObjectBinder ¶
type ObjectBinder func(builder ObjectBuilder)
type ObjectBuilder ¶
type ObjectBuilder interface { DefineFunction(functionName, propertyName string, function NativeFunction) ObjectBuilder DefineGoFunction(functionName, propertyName string, function GoFunction) ObjectBuilder DefineConstant(constantName string, value interface{}) ObjectBuilder DefineSimpleProperty(propertyName string, value interface{}) ObjectBuilder DefineObjectProperty(objectName string, objectBinder ObjectBinder) ObjectBuilder DefineAccessorProperty(propertyName string, getter Getter, setter Setter) ObjectBuilder }
type ObjectCreator ¶
type ObjectCreator interface { ObjectBuilder Build() Object BuildInto(objectName string, parent Object) }
type PropertyDescriptor ¶
type PropertyDescriptor struct { Original interface{} Value Value Getter Getter Setter Setter Writable PropertyFlag Configurable PropertyFlag Enumerable PropertyFlag }
type PropertyFlag ¶
type PropertyFlag uint8
const ( Flag_NotSet PropertyFlag = iota Flag_False Flag_True )
type ResourceLoader ¶
type Sandbox ¶
type Sandbox interface { NewObject() Object // NewObjectCreator returns an ObjectCreator instance which can be used // to define script Object instances. // // The provided objectName will be used to register the object with the // given parent when ObjectCreator::BuildInto is called. NewObjectCreator(objectName string) ObjectCreator NewNamedNativeFunction(functionName string, function GoFunction) Value NewTypeError(args ...interface{}) Object NewError(err error) Object NewModuleProxy(object Object, objectName string, caller Bundle) (Object, error) IsAccessible(module Module, caller Bundle) error Compile(filename, source string) (script Script, cacheable bool, err error) Execute(script Script) (Value, error) CaptureCallStack(maxStackFrames int) []StackFrame NewDebugger() (interface{}, error) Global() Object NullValue() Value UndefinedValue() Value ToValue(value interface{}) Value Export(value Value, target interface{}) error }
type SecurityInterceptor ¶
type StackFrame ¶
type Value ¶
type Value interface { ToInteger() int64 ToFloat() float64 ToBoolean() bool ToNumber() Value ToString() Value ToObject() Object SameAs(other Value) bool Equals(other Value) bool StrictEquals(other Value) bool Export() interface{} ExportType() reflect.Type String() string IsObject() bool IsArray() bool IsDefined() bool Unwrap() interface{} }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.