Skip to main content

ReactiveSetup

Function type Reactive Adapter's first argument setup

interface ReactiveSetup<Instance extends [ReactiveSubscribe](../../Reactive-Decorator/Function/ReactiveSubscribe)<Record>, State extends Record<string, any> = [ReactiveState](../Type/ReactiveState)<Instance>, Methods extends keyof Partial<Instance> = never, Props = any, Events extends Record<string, any> = {}>

Methods

Trigger events directly externally.

Get external props.

Register events defined between Mounted and Init Lifecycle.

Register hooks to occur in Destroy Lifecycle.

Register hooks to occur in Init Lifecycle.

Register hooks that will occur in Mounted Lifecycle.

Set the events to be exposed.

Set the first Initial state.
Do not set the return value if it exists.

Sets the functions to be exposed in the instance.

Methods

emit

emit

void

emit<EventName>(eventName: EventName, ...params: EventTriggerParams<Events, EventName>): void

Trigger events directly externally.

Parameters

eventName

EventName

params

EventTriggerParams<Events, EventName>

getProps

getProps

Props

getProps(): Props

Get external props.

on

on

void

on(callback: (<EventName>(instance: Instance, eventName: EventName, listener: ReactiveEventCallback<Events, EventName>) => void | (() => void))): void

Register events defined between Mounted and Init Lifecycle.

Parameters

callback

(<EventName>(instance: Instance, eventName: EventName, listener: ReactiveEventCallback<Events, EventName>) => void | (() => void))

onDestroy

onDestroy

void

onDestroy(callback: ((instance: Instance, props: Props) => void)): void

Register hooks to occur in Destroy Lifecycle.

Parameters

callback

((instance: Instance, props: Props) => void)

onInit

onInit

void

onInit(callback: ((instance: Instance, props: Props) => void)): void

Register hooks to occur in Init Lifecycle.

Parameters

callback

((instance: Instance, props: Props) => void)

onMounted

onMounted

void

onMounted(callback: ((props: Props, instance: null | Instance) => void | Instance)): void

Register hooks that will occur in Mounted Lifecycle.

Parameters

callback

((props: Props, instance: null | Instance) => void | Instance)

setEvents

setEvents

void

setEvents(events: readonly (keyof Events)[]): void

Set the events to be exposed.

Parameters

events

readonly (keyof Events)[]

setInitialState

setInitialState

void

setInitialState(state: State): void

Set the first Initial state.
Do not set the return value if it exists.

Parameters

state

State

setMethods

setMethods

void

setMethods(methods: readonly Methods[]): void

Sets the functions to be exposed in the instance.

Parameters

methods

readonly Methods[]