appcontext

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: May 10, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Spell    = "Spell"
	Renderer = "Renderer"
)

List of consts containing the names of the available componentes in the Application Context - appcontext.Current

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationContext

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

ApplicationContext is the type defining a map of Components

var Current ApplicationContext

Current keeps all components available, initialized in the application startup

func CreateApplicationContext

func CreateApplicationContext() ApplicationContext

CreateApplicationContext creates a new ApplicationContext instance

func (*ApplicationContext) Add

func (applicationContext *ApplicationContext) Add(componentName string, componentInitializerFunction ComponentInitializerFunction)

Add a component By Name

func (*ApplicationContext) Count

func (applicationContext *ApplicationContext) Count() int

Count returns the count of components registered

func (*ApplicationContext) Delete

func (applicationContext *ApplicationContext) Delete(componentName string)

Delete a component By Name

func (*ApplicationContext) Get

func (applicationContext *ApplicationContext) Get(componentName string) Component

Get a component By Name

type Component

type Component interface{}

Component is the Base interface for all Components

type ComponentInfo

type ComponentInfo struct {
	Initializer ComponentInitializerFunction
	Instance    Component
}

ComponentInfo holds the function to lazy initialize the component and the instance created following the singleton pattern

func (*ComponentInfo) Get

func (componentInfo *ComponentInfo) Get() Component

Get s the instance. If it is not created, creates and stores it to the next calls

type ComponentInitializerFunction

type ComponentInitializerFunction func() Component

ComponentInitializerFunction specifies a function for lazily initializing a component

Jump to

Keyboard shortcuts

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