app

package
v0.0.0-...-8444db5 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceName service.Name = "app"
)

Variables

View Source
var (
	ErrBundleNotFound = errors.New("bundle not found")
	ErrNoBackend      = errors.New("no backend")
)
View Source
var ErrFuncDoesNotExist = errors.New("function does not exist")
View Source
var ErrUnknownBundleArchiveFormat = errors.New("unknown bundle archive format")

Functions

func LoadAppManifest

func LoadAppManifest(b bundle.Bundle) (*repository.AppManifest, error)

func ServiceProvider

func ServiceProvider() service.Provider

Types

type Backend

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

func NewBackend

func NewBackend(appID repository.AppID, modules ...BackendModuleFactory) *Backend

func (*Backend) Exec

func (b *Backend) Exec(callable goja.Callable, args ...interface{}) (goja.Value, error)

func (*Backend) ExecFuncByName

func (b *Backend) ExecFuncByName(funcName string, args ...interface{}) (goja.Value, error)

func (*Backend) IsPromise

func (b *Backend) IsPromise(v goja.Value) (*goja.Promise, bool)

func (*Backend) Load

func (b *Backend) Load(src string) error

func (*Backend) NewPromise

func (b *Backend) NewPromise() *PromiseProxy

func (*Backend) OnInit

func (b *Backend) OnInit() error

func (*Backend) OnUserConnect

func (b *Backend) OnUserConnect(id repository.UserID) error

func (*Backend) OnUserDisconnect

func (b *Backend) OnUserDisconnect(id repository.UserID) error

func (*Backend) OnUserMessage

func (b *Backend) OnUserMessage(id repository.UserID, data interface{}) error

func (*Backend) Start

func (b *Backend) Start()

func (*Backend) Stop

func (b *Backend) Stop()

func (*Backend) ToValue

func (b *Backend) ToValue(v interface{}) goja.Value

func (*Backend) WaitForPromise

func (b *Backend) WaitForPromise(promise *goja.Promise) goja.Value

type BackendModule

type BackendModule interface {
	Name() string
	Export(*goja.Object)
}

type BackendModuleFactory

type BackendModuleFactory func(repository.AppID, *Backend) BackendModule

type FilesystemLoader

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

func NewFilesystemLoader

func NewFilesystemLoader(searchPatterns ...string) *FilesystemLoader

func (*FilesystemLoader) Load

func (l *FilesystemLoader) Load(ctx context.Context) ([]*LoadedApp, error)

type LoadedApp

type LoadedApp struct {
	App    *repository.App
	Bundle bundle.Bundle
}

type Manager

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

func From

func From(container *service.Container) (*Manager, error)

From retrieves the app manager in the given service container

func Must

func Must(container *service.Container) *Manager

Must retrieves the app manager in the given service container or panic otherwise

func NewManager

func NewManager() *Manager

func (*Manager) GetBackend

func (m *Manager) GetBackend(id repository.AppID, modules ...BackendModuleFactory) (*Backend, error)

func (*Manager) GetBundle

func (m *Manager) GetBundle(id repository.AppID) (bundle.Bundle, error)

func (*Manager) SetBundle

func (m *Manager) SetBundle(id repository.AppID, b bundle.Bundle)

type PromiseProxy

type PromiseProxy struct {
	*goja.Promise
	// contains filtered or unexported fields
}

func NewPromiseProxy

func NewPromiseProxy(promise *goja.Promise, resolve func(result interface{}), reject func(reason interface{})) *PromiseProxy

func (*PromiseProxy) Reject

func (p *PromiseProxy) Reject(reason interface{})

func (*PromiseProxy) Resolve

func (p *PromiseProxy) Resolve(result interface{})

func (*PromiseProxy) Wait

func (p *PromiseProxy) Wait()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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