Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Consumer<S, A, S, A>

Type parameters

  • S: object

  • A: object

  • S: object

  • A: object

Hierarchy

  • Tag<Props>
    • Consumer

Index

Type aliases

Static Transform

Transform: object | string[] | function

Properties

Optional _aliases

_aliases: object

_consumes

_consumes: string[] = []

_eventHandlers

_eventHandlers: [string, function][] = []

_lookups

_lookups: [string[], function][] = []

_provides

_provides: Record<string, function>

_riot_id

_riot_id: number

actions

actions: ActionCreators

config

flux

flux: FluxCapacitor

isConsumer

isConsumer: boolean = true

isInitialized

isInitialized: boolean = false

isMounted

isMounted: boolean

log

log: Log

opts

opts: Props

Optional parent

parent: TagInstance

the parent tag if any

props

props: Props & Props = <any>{}

refs

refs: TagRefs

References to tags or DOM elements

root

root: HTMLElement

services

services: SystemServices

state

state: S = <any>{}

tags

tags: NestedTags

nested custom tags

Methods

_removeEventHandlers

  • _removeEventHandlers(): void

_removeLookups

  • _removeLookups(): void

consume

  • consume(alias: string): void

dispatch

  • dispatch(action: Action<string, any>): void

expose

  • expose(alias: string, value?: any): void

init

  • init(): void

mixin

  • mixin(mixin: string | TagMixin): void
  • Extend tag with functionality available on shared mixin registered with riot.mixin(mixinName, mixinObject) or extend tag functionality with functionality available on provided mixin object.

    Parameters

    • mixin: string | TagMixin

      Name of shared mixin or mixin object

    Returns void

mount

  • mount(): void
  • Mount the tag

    Returns void

off

  • off(event: string, callback?: ObservableCallback): this
  • For specified event remove specified callback or all registered callbacks if callback is not passed in

    Parameters

    • event: string

      Event name or wildcard '*' that matches all events

    • Optional callback: ObservableCallback

      Callback function to remove

    Returns this

on

  • on(event: string, callback: ObservableCallback): this
  • Register callback for specified events. Callback is executed each time event is triggered

    Parameters

    • event: string

      Event name or wildcard '*' that matches all events

    • callback: ObservableCallback

      Callback function

    Returns this

onBeforeMount

  • onBeforeMount(): void

onBeforeUnmount

  • onBeforeUnmount(): void

onMount

  • onMount(): void

onUnmount

  • onUnmount(): void

onUpdate

  • onUpdate(stateChange?: object): void

onUpdated

  • onUpdated(): void

one

  • one(event: string, callback: ObservableCallback): this
  • Register callback for specified events. Callback is executed at most once.

    Parameters

    • event: string

      Event name.

    • callback: ObservableCallback

      Callback function

    Returns this

provide

  • provide(alias: string, resolve?: function): void
  • Parameters

    • alias: string
    • Default value resolve: function = (_, state) => state
        • (props: Props, state: S, aliases: A): void
        • Parameters

          • props: Props
          • state: S
          • aliases: A

          Returns void

    Returns void

select

  • select(selector: function, ...args: any[]): any
  • Parameters

    • selector: function
        • (state: State, ...args: any[]): any
        • Parameters

          • state: State
          • Rest ...args: any[]

          Returns any

    • Rest ...args: any[]

    Returns any

set

  • set(state: Partial<S> | true): void

shouldUpdate

  • shouldUpdate(stateChange: object, nextOpts: Props): boolean

subscribe

  • subscribe<T>(event: string, handler: function): void
  • Invoke the callback provided each time the target event is emitted.

    All callbacks are automatically removed when the component is unmounted.

    Type parameters

    • T

    Parameters

    • event: string
    • handler: function
        • (data?: T): void
        • Parameters

          • Optional data: T

          Returns void

    Returns void

subscribeOnce

  • subscribeOnce(event: string, handler: function): void
  • Invoke the callback provided the next time the target event is emitted, then unregister it.

    Parameters

    • event: string
    • handler: function
        • (event: string, data?: any): void
        • Parameters

          • event: string
          • Optional data: any

          Returns void

    Returns void

subscribeWith

  • subscribeWith<T>(events: string[], handler: function): void
  • Invoke the callback provided each time the member events have been emitted at least once.

    All callbacks are automatically removed when the component is unmounted.

    Type parameters

    • T

    Parameters

    • events: string[]
    • handler: function
        • (data?: T): void
        • Parameters

          • Optional data: T

          Returns void

    Returns void

trigger

  • trigger(event: string, ...args: any[]): this
  • Execute all callback functions registered for specified list of events

    Parameters

    • event: string

      Event name

    • Rest ...args: any[]

      Arguments provided to callbacks

    Returns this

unexpose

  • unexpose(alias: string): void

unmount

  • unmount(keepTheParent?: boolean): void
  • Detach the tag and its children from the page.

    Parameters

    • Optional keepTheParent: boolean

      If true unmounting tag doesn't remove the parent tag

    Returns void

update

  • update(data?: any): void
  • Updates all the expressions on the current tag instance as well as on all the children.

    Parameters

    • Optional data: any

      Context data

    Returns void

updateAlias

  • updateAlias(alias: string, value: any): void

Static create

  • create(_riot: any): (Anonymous function)

Static findAliases

  • findAliases(tag: Tag, keys?: string[]): Record<string, object>

Static findAllAliases

  • findAllAliases(tag: Tag): Record<string, object>

Static findConsumes

  • findConsumes(tag: Tag & object): string[]

Static getDescription

Static getMeta

Static getName

  • getName(tag: Tag): string

Static mixin

  • mixin(__namedParameters: object): Mixin

Static setDescription

Generated using TypeDoc