Skip to content

Toaster

Defined in: ui/Toaster.ts:85

Toaster component that manages the display and positioning of toast notifications.

// Create a toaster
const toaster = new Toaster({
position: 'top right',
maxToasts: 3
});
// Show a basic toast
toaster.show({
message: "Operation successful!",
type: "success"
});
// Show a custom toast
toaster.show({
message: "Custom notification",
backgroundColor: 0x9b59b6,
shadow: {
color: 0x000000,
alpha: 0.2,
offset: { x: 4, y: 4 }
}
});
// Hide all toasts
toaster.hideAll();

new Toaster(config, defaultToastConfig): Toaster

Defined in: ui/Toaster.ts:180

Create a new Toaster instance to manage toast notifications.

Partial<ToasterConfig> = {}

Configuration for the Toaster’s position, spacing, and behavior

Partial<ToastConfig> = {}

Default configuration applied to all toasts shown by this Toaster

Toaster

// Basic toaster with default settings
const toaster = new Toaster();
// Toaster with custom position and behavior
const toaster = new Toaster({
position: 'bottom center',
maxToasts: 3,
spacing: 15,
offset: { x: 20, y: 30 },
stackDirection: 'up'
});
// Toaster with custom defaults for all toasts
const toaster = new Toaster(
{
position: 'top right',
maxToasts: 5
},
{
backgroundColor: 0x000000,
backgroundAlpha: 0.8,
cornerRadius: 8,
shadow: {
color: 0x000000,
alpha: 0.2,
offset: { x: 4, y: 4 }
},
closeButton: {
show: true,
position: 'top right'
}
}
);
// The defaultToastConfig will be applied to all toasts,
// but can be overridden per toast:
toaster.show({ message: "Uses default config" });
toaster.show({
message: "Custom config",
backgroundColor: 0x9b59b6 // Overrides default
});

WithSignals(Container).constructor

__dill_pixel_method_binding_root: boolean = true

Defined in: display/Container.ts:68

WithSignals(Container).__dill_pixel_method_binding_root


add: object

Defined in: mixins/factory/Factory.ts:6

animatedSprite: (props?) => AnimatedSprite

Partial<AnimatedSpriteProps>

AnimatedSprite

bitmapText: (props?) => BitmapText

Partial<TextProps>

BitmapText

button: (props?) => Button

Partial<ButtonProps>

Button

container: (props?) => Container<Application<DataSchema, ActionContext, Action, Renderer>>

Partial<ContainerProps>

Container<Application<DataSchema, ActionContext, Action, Renderer>>

existing: <TEntity>(entity, props?) => TEntity

TEntity

TEntity

Partial<ExistingProps>

TEntity

flexContainer: (props?) => FlexContainer

Partial<FlexContainerProps>

FlexContainer

graphics: (props?) => Graphics

Partial<GraphicsProps>

Graphics

htmlText: (props?) => HTMLText

Partial<HTMLTextProps>

HTMLText

particleContainer: (props?) => ParticleContainer<Application<DataSchema, ActionContext, Action, Renderer>>

Partial<ParticleContainerProps>

ParticleContainer<Application<DataSchema, ActionContext, Action, Renderer>>

spine: (props?) => Spine

Partial<SpineProps>

Spine

spineAnimation: <ANames, A>(props?) => SpineAnimation<ANames, A>

ANames extends string = string

A extends Application<DataSchema, ActionContext, Action, Renderer> = Application<DataSchema, ActionContext, Action, Renderer>

Partial<SpineProps>

SpineAnimation<ANames, A>

sprite: (props?) => Sprite

Partial<SpriteProps>

Sprite

text: (props?) => Text

Partial<TextProps>

Text

texture: (props?) => Texture = resolveTexture

Partial<TextureProps>

Texture

tilingSprite: (props?) => TilingSprite

Partial<TilingSpriteProps>

TilingSprite

toaster: (toasterConfig?, defaultToastConfig) => Toaster

Partial<ToasterConfig>

Partial<ToastConfig> = {}

Toaster

uiCanvas: (props?) => UICanvas

Partial<UICanvasFactoryProps>

UICanvas

svg(props): Svg

WithRequiredProps<SvgProps, "ctx">

Svg

WithSignals(Container).add


config: ToasterConfig

Defined in: ui/Toaster.ts:93


defaultToastConfig: Partial<ToastConfig>

Defined in: ui/Toaster.ts:94


make: object

Defined in: mixins/factory/Factory.ts:7

animatedSprite: (props?) => AnimatedSprite

Partial<AnimatedSpriteProps>

AnimatedSprite

bitmapText: (props?) => BitmapText

Partial<TextProps>

BitmapText

button: (props?) => Button

Partial<ButtonProps>

Button

container: (props?) => Container<Application<DataSchema, ActionContext, Action, Renderer>>

Partial<ContainerProps>

Container<Application<DataSchema, ActionContext, Action, Renderer>>

existing: <TEntity>(entity, props?) => TEntity

TEntity

TEntity

Partial<ExistingProps>

TEntity

flexContainer: (props?) => FlexContainer

Partial<FlexContainerProps>

FlexContainer

graphics: (props?) => Graphics

Partial<GraphicsProps>

Graphics

htmlText: (props?) => HTMLText

Partial<HTMLTextProps>

HTMLText

particleContainer: (props?) => ParticleContainer<Application<DataSchema, ActionContext, Action, Renderer>>

Partial<ParticleContainerProps>

ParticleContainer<Application<DataSchema, ActionContext, Action, Renderer>>

spine: (props?) => Spine

Partial<SpineProps>

Spine

spineAnimation: <ANames, A>(props?) => SpineAnimation<ANames, A>

ANames extends string = string

A extends Application<DataSchema, ActionContext, Action, Renderer> = Application<DataSchema, ActionContext, Action, Renderer>

Partial<SpineProps>

SpineAnimation<ANames, A>

sprite: (props?) => Sprite

Partial<SpriteProps>

Sprite

text: (props?) => Text

Partial<TextProps>

Text

texture: (props?) => Texture = resolveTexture

Partial<TextureProps>

Texture

tilingSprite: (props?) => TilingSprite

Partial<TilingSpriteProps>

TilingSprite

toaster: (toasterConfig?, defaultToastConfig) => Toaster

Partial<ToasterConfig>

Partial<ToastConfig> = {}

Toaster

uiCanvas: (props?) => UICanvas

Partial<UICanvasFactoryProps>

UICanvas

svg(props): Svg

WithRequiredProps<SvgProps, "ctx">

Svg

WithSignals(Container).make


readonly onAllToastsRemoved: Signal<() => void>

Defined in: ui/Toaster.ts:91

Emitted when all toasts are removed


onAnimationComplete: Signal<(entity) => void>

Defined in: mixins/animated.ts:21

WithSignals(Container).onAnimationComplete


onAnimationStart: Signal<(entity) => void>

Defined in: mixins/animated.ts:19

WithSignals(Container).onAnimationStart


onAnimationUpdate: Signal<(entity) => void>

Defined in: mixins/animated.ts:20

WithSignals(Container).onAnimationUpdate


onDestroy: Signal<() => void>

Defined in: display/Container.ts:67

WithSignals(Container).onDestroy


readonly onToastAdded: Signal<(toast) => void>

Defined in: ui/Toaster.ts:87

Emitted when a new toast is added


readonly onToastRemoved: Signal<(toast) => void>

Defined in: ui/Toaster.ts:89

Emitted when a toast is removed


signalConnections: SignalConnections

Defined in: mixins/signals.ts:9

WithSignals(Container).signalConnections


static onGlobalChildAdded: Signal<(child) => void>

Defined in: display/Container.ts:81

WithSignals(Container).onGlobalChildAdded


static onGlobalChildRemoved: Signal<(child) => void>

Defined in: display/Container.ts:82

WithSignals(Container).onGlobalChildRemoved

get animationContext(): undefined | string

Defined in: display/Container.ts:72

undefined | string

set animationContext(value): void

Defined in: display/Container.ts:75

string

void

WithSignals(Container).animationContext


get app(): A

Defined in: display/Container.ts:111

Get the application instance.

A

WithSignals(Container).app


get maxToasts(): number

Defined in: ui/Toaster.ts:121

number


get offset(): number | { x: number; y: number; }

Defined in: ui/Toaster.ts:117

number | { x: number; y: number; }


get size(): number

Defined in: ui/Toaster.ts:101

Get the current number of visible toasts

number


get spacing(): number

Defined in: ui/Toaster.ts:113

number


get stackDirection(): "up" | "down"

Defined in: ui/Toaster.ts:109

"up" | "down"


get toastConfig(): Partial<ToastConfig>

Defined in: ui/Toaster.ts:125

Partial<ToastConfig>


get toastPosition(): UICanvasEdge

Defined in: ui/Toaster.ts:105

UICanvasEdge

addColoredBackground(colorOrConfig, alpha): Sprite

Defined in: display/Container.ts:115

number | Partial<BackgroundConfig>

number = 1

Sprite

WithSignals(Container).addColoredBackground


added(): void

Defined in: display/Container.ts:174

This method is called when the container is added to the stage. It is meant to be overridden by subclasses.

void

WithSignals(Container).added


addSignalConnection(…args): void

Defined in: mixins/signals.ts:13

SignalConnection[]

void

WithSignals(Container).addSignalConnection


animate(animationProps, instance?): Tween

Defined in: mixins/animated.ts:23

GSAPAnimationConfigExtended

any

Tween

WithSignals(Container).animate


animateFrom(animationProps, instance?): Tween

Defined in: mixins/animated.ts:25

GSAPAnimationConfigExtended

any

Tween

WithSignals(Container).animateFrom


animateFromTo(fromProps, toProps, instance?): Tween

Defined in: mixins/animated.ts:27

GSAPAnimationConfigExtended

GSAPAnimationConfigExtended

any

Tween

WithSignals(Container).animateFromTo


animateSequence(sequences, instance?): Timeline

Defined in: mixins/animated.ts:33

GSAPAnimationConfigExtended[]

any

Timeline

WithSignals(Container).animateSequence


bob(config?, instance?): Tween

Defined in: mixins/animated.ts:50

number

number

any

Tween

WithSignals(Container).bob


childAdded(child): void

Defined in: display/Container.ts:176

Container

void

WithSignals(Container).childAdded


childRemoved(child): void

Defined in: display/Container.ts:191

Container

void

WithSignals(Container).childRemoved


connectAction(…args): void

Defined in: mixins/signals.ts:15

SignalConnection[]

void

WithSignals(Container).connectAction


connectSignal(…args): void

Defined in: mixins/signals.ts:14

SignalConnection[]

void

WithSignals(Container).connectSignal


destroy(): void

Defined in: ui/Toaster.ts:399

void

WithSignals(Container).destroy


destroyAnimations(): void

Defined in: mixins/animated.ts:39

void

WithSignals(Container).destroyAnimations


hideAll(): Promise<void>

Defined in: ui/Toaster.ts:260

Hide all currently visible toasts with animation

Promise<void>

Promise that resolves when all toasts are hidden


isAnimationPlaying(): boolean

Defined in: mixins/animated.ts:43

boolean

WithSignals(Container).isAnimationPlaying


pauseAnimations(): void

Defined in: mixins/animated.ts:35

void

WithSignals(Container).pauseAnimations


positionToasts(animate, skipLast): void

Defined in: ui/Toaster.ts:304

Update positions of all toasts

boolean = true

Whether to animate the position changes

boolean = false

Whether to skip positioning the last toast

void


pulse(config?, instance?): Tween

Defined in: mixins/animated.ts:48

number

number

number

any

Tween

WithSignals(Container).pulse


removeAll(): Promise<void>

Defined in: ui/Toaster.ts:273

Remove all toasts (alias for hideAll)

Promise<void>


removed(): void

Defined in: display/Container.ts:189

void

WithSignals(Container).removed


resize(): void

Defined in: ui/Toaster.ts:394

Handle window resize events

void

WithSignals(Container).resize


resumeAnimations(): void

Defined in: mixins/animated.ts:37

void

WithSignals(Container).resumeAnimations


reverseAnimation(): void

Defined in: mixins/animated.ts:41

void

WithSignals(Container).reverseAnimation


shake(config?, instance?): Tween

Defined in: mixins/animated.ts:46

number

number

number

any

Tween

WithSignals(Container).shake


show(config, overrideDefaults): Promise<Toast>

Defined in: ui/Toaster.ts:197

Display a new toast notification

Partial<ToastConfig> = ...

Configuration for the toast to display

boolean = false

Promise<Toast>

Promise that resolves with the created toast


update(ticker?): void

Defined in: display/Container.ts:159

Update the container. This method is meant to be overridden by subclasses.

number | Ticker

void

WithSignals(Container).update


static childAdded(child): void

Defined in: display/Container.ts:84

Container

void

WithSignals(Container).childAdded


static childRemoved(child): void

Defined in: display/Container.ts:88

Container

void

WithSignals(Container).childRemoved