js

package
v0.1.36 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CamelCaseMapper camelCaseMapper

Functions

func ToCamelCase

func ToCamelCase(name string) string

Types

type Context added in v0.1.33

type Context struct {
	Environment *Environment
	Parent      *Context
	Module      *Module
	Resolve     ResolveFunc
	Extensions  []goja.Value
}

type CreateExtensionFunc added in v0.1.32

type CreateExtensionFunc func(context *Context) goja.Value

type CreateResolverFunc added in v0.1.32

type CreateResolverFunc func(url urlpkg.URL, context *Context) ResolveFunc

type Environment added in v0.1.32

type Environment struct {
	Runtime        *goja.Runtime
	URLContext     *urlpkg.Context
	Watcher        *fswatch.Watcher
	Extensions     []Extension
	Modules        *goja.Object
	Precompile     PrecompileFunc
	CreateResolver CreateResolverFunc
	Log            logging.Logger
	// contains filtered or unexported fields
}

func NewEnvironment added in v0.1.32

func NewEnvironment(urlContext *urlpkg.Context) *Environment

func (*Environment) AddModule added in v0.1.33

func (self *Environment) AddModule(url urlpkg.URL, module *Module)

func (*Environment) NewContext added in v0.1.33

func (self *Environment) NewContext(url urlpkg.URL, parent *Context) *Context

func (*Environment) NewModule added in v0.1.33

func (self *Environment) NewModule() *Module

func (*Environment) Release added in v0.1.33

func (self *Environment) Release() error

func (*Environment) RequireID added in v0.1.33

func (self *Environment) RequireID(id string) (*goja.Object, error)

func (*Environment) RequireURL added in v0.1.32

func (self *Environment) RequireURL(url urlpkg.URL) (*goja.Object, error)

func (*Environment) Watch added in v0.1.33

func (self *Environment) Watch(onChanged OnChangedFunc) error

type Extension added in v0.1.32

type Extension struct {
	Name   string
	Create CreateExtensionFunc
}

type FileAPI added in v0.1.31

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

func NewFileAPI added in v0.1.32

func NewFileAPI(context *urlpkg.Context) FileAPI

func (FileAPI) Download added in v0.1.32

func (self FileAPI) Download(sourceUrl string, targetPath string) error

func (FileAPI) Exec added in v0.1.31

func (self FileAPI) Exec(name string, arguments ...string) (string, error)

func (FileAPI) JoinFilePath added in v0.1.32

func (self FileAPI) JoinFilePath(elements ...string) string

func (FileAPI) TemporaryDirectory added in v0.1.31

func (self FileAPI) TemporaryDirectory(pattern string, directory string) (string, error)

func (FileAPI) TemporaryFile added in v0.1.31

func (self FileAPI) TemporaryFile(pattern string, directory string) (string, error)

type FormatAPI added in v0.1.31

type FormatAPI struct{}

func (FormatAPI) Atob added in v0.1.31

func (self FormatAPI) Atob(b64 string) ([]byte, error)

Decode base64 to bytes

func (FormatAPI) Btoa added in v0.1.31

func (self FormatAPI) Btoa(bytes []byte) string

Encode bytes as base64

func (FormatAPI) BytesToString added in v0.1.31

func (self FormatAPI) BytesToString(bytes []byte) string

Another way to achieve this in JavaScript: String.fromCharCode.apply(null, bytes)

func (FormatAPI) Decode added in v0.1.31

func (self FormatAPI) Decode(code string, format string, all bool) (ard.Value, error)

func (FormatAPI) Encode added in v0.1.31

func (self FormatAPI) Encode(value interface{}, format string, indent string, writer io.Writer) (string, error)

func (FormatAPI) NewXMLDocument added in v0.1.31

func (self FormatAPI) NewXMLDocument() *etree.Document

func (FormatAPI) StringToBytes added in v0.1.31

func (self FormatAPI) StringToBytes(string_ string) []byte

func (FormatAPI) ValidateFormat added in v0.1.31

func (self FormatAPI) ValidateFormat(code string, format string) error

type Module added in v0.1.33

type Module struct {
	Id           string
	Children     []*Module
	Filename     string
	Path         string
	Paths        []string // unused
	Exports      *goja.Object
	Require      *goja.Object
	IsPreloading bool
	Loaded       bool
}

type OnChangedFunc added in v0.1.33

type OnChangedFunc func(id string, module *Module)

type PrecompileFunc added in v0.1.32

type PrecompileFunc func(url urlpkg.URL, script string, context *Context) (string, error)

type ResolveFunc added in v0.1.32

type ResolveFunc func(id string) (urlpkg.URL, error)

type ThreadSafeObject added in v0.1.32

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

func NewThreadSafeObject added in v0.1.32

func NewThreadSafeObject() *ThreadSafeObject

func (*ThreadSafeObject) Delete added in v0.1.32

func (self *ThreadSafeObject) Delete(key string) bool

goja.DynamicObject interface

func (*ThreadSafeObject) Get added in v0.1.32

func (self *ThreadSafeObject) Get(key string) goja.Value

goja.DynamicObject interface

func (*ThreadSafeObject) Has added in v0.1.32

func (self *ThreadSafeObject) Has(key string) bool

goja.DynamicObject interface

func (*ThreadSafeObject) Keys added in v0.1.32

func (self *ThreadSafeObject) Keys() []string

goja.DynamicObject interface

func (*ThreadSafeObject) NewDynamicObject added in v0.1.32

func (self *ThreadSafeObject) NewDynamicObject(runtime *goja.Runtime) *goja.Object

func (*ThreadSafeObject) Set added in v0.1.32

func (self *ThreadSafeObject) Set(key string, value goja.Value) bool

goja.DynamicObject interface

type UtilAPI added in v0.1.31

type UtilAPI struct{}

func (UtilAPI) DeepCopy added in v0.1.31

func (self UtilAPI) DeepCopy(value ard.Value) ard.Value

func (UtilAPI) DeepEquals added in v0.1.31

func (self UtilAPI) DeepEquals(a ard.Value, b ard.Value) bool

func (UtilAPI) Go added in v0.1.32

func (self UtilAPI) Go(value goja.Value) error

Goroutine

func (UtilAPI) Hash added in v0.1.31

func (self UtilAPI) Hash(value ard.Value) (string, error)

func (UtilAPI) IsType added in v0.1.31

func (self UtilAPI) IsType(value ard.Value, type_ string) (bool, error)

func (UtilAPI) Mutex added in v0.1.31

func (self UtilAPI) Mutex() *sync.Mutex

func (UtilAPI) Now added in v0.1.31

func (self UtilAPI) Now() time.Time

func (UtilAPI) Sprintf added in v0.1.31

func (self UtilAPI) Sprintf(format string, args ...interface{}) string

Jump to

Keyboard shortcuts

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