Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Controller

控制器

Hierarchy

Index

Constructors

constructor

Properties

Protected eventMap

eventMap: Map<string, Set<Function>>

Methods

Optional bindElement

  • 绑定元素到当前控制器

    Parameters

    Returns void

bindView

  • bindView(view: View): void
  • 绑定视图到当前控制器

    Parameters

    • view: View

      需要绑定的视图

    Returns void

dispose

  • dispose(): void
  • Returns void

Protected emit

  • emit(event: string, ...args: unknown[]): void
  • Parameters

    • event: string
    • Rest ...args: unknown[]

    Returns void

Optional initWithScene

  • initWithScene(scene: Scene): void
  • 对于需要Scene的controller, 初始化时会传递scene

    Parameters

    • scene: Scene

      传入的Scene

    Returns void

off

  • off(event: string, callback: Function): void
  • 注销事件监听

    Parameters

    • event: string

      事件名

    • callback: Function

      回调函数

    Returns void

on

  • on(event: string, callback: Function): void
  • 注册事件监听

    Parameters

    • event: string

      事件名

    • callback: Function

      回调函数

    Returns void

Optional renderingViewChanged

  • renderingViewChanged(view: View): void
  • 对于需要根据View变化的Controller, 使用该钩子函数进行处理

    Parameters

    • view: View

      当前view

    Returns void

unbind

  • unbind(): void
  • deprecated

    解除当前绑定的视图

    Returns void

Optional unbindElement

  • 将目标元素解除绑定, 解除绑定的元素将不再被该控制器所管理

    Parameters

    Returns void

unbindView

  • unbindView(): void
  • 解除当前绑定的视图

    Returns void