modules

package
v0.0.0-...-5119766 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationContext

type ApplicationContext interface {
	ApplicationID() string
	ApplicationVersion() types.ApplicationVersion
	ApplicationStartTime() time.Time
	RuntimeVersion() int
	ApplicationUser() auth.User

	Logger() ApplicationLogger
	LifecycleManager() LifecycleManager

	Schedule(func(*goja.Runtime) error)
	ScheduleNoError(func(*goja.Runtime))
}

ApplicationContext is the context of an application as passed to a module instance

type ApplicationLogger

type ApplicationLogger interface {
	RuntimeAuditLog(s string)
}

ApplicationLogger logs application actions

type Collection

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

Collection is a set of NativeModules that belongs to a single application instance

func (*Collection) BuildRegistry

func (c *Collection) BuildRegistry(sourceLoader SourceLoader) *require.Registry

func (*Collection) EnableModules

func (c *Collection) EnableModules(runtime *goja.Runtime)

func (*Collection) ExecutionResumed

func (c *Collection) ExecutionResumed(ctx context.Context, wg *sync.WaitGroup, runtime *goja.Runtime)

func (*Collection) RegisterNativeModule

func (c *Collection) RegisterNativeModule(m NativeModule)

type Dependencies

type Dependencies struct {
	ModLogWebhook                api.WebhookClient
	ChatManager                  *chatmanager.Manager
	PointsManager                *pointsmanager.Manager
	MediaQueue                   *mediaqueue.MediaQueue
	MediaProviders               map[types.MediaType]media.Provider
	Pricer                       *pricer.Pricer
	SkipManager                  *skipmanager.Manager
	OtherMediaQueueMethods       OtherMediaQueueMethods
	PaymentAccountPool           *payment.PaymentAccountPool
	DefaultAccountRepresentative string
	UserCache                    usercache.UserCache
	RewardsHandler               *rewards.Handler
	StatsRegistry                *stats.Registry
}

Dependencies is a "everything and the kitchen sink" struct used for injection of singleton dependencies in modules

type LifecycleManager

type LifecycleManager interface {
	AbortProcess()
	ExitProcess(exitCode int)
}

LifecycleManager can manage the application's execution lifecycle

type NativeModule

type NativeModule interface {
	ModuleLoader() require.ModuleLoader
	ModuleName() string
	IsNodeBuiltin() bool
	AutoRequire() (bool, string)
	ExecutionResumed(context.Context, *sync.WaitGroup, *goja.Runtime)
}

NativeModule is a module that can be imported into a single application instance

type OtherMediaQueueMethods

type OtherMediaQueueMethods interface {
	MediaEnqueuingPermission() proto.AllowedMediaEnqueuingType
	SetMediaEnqueuingPermission(permission proto.AllowedMediaEnqueuingType, password string)
	NewQueueEntriesAllUnskippable() bool
	SetNewQueueEntriesAllUnskippable(bool)
	MoveQueueEntryWithCost(ctx context.Context, entryID string, up bool, user auth.User) error
}

type SourceLoader

type SourceLoader func(*goja.Runtime, string) ([]byte, error)

SourceLoader is a function responsible for loading sources

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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