Options
All
  • Public
  • Public/Protected
  • All
Menu

发布订阅模式

Type parameters

  • T

    订阅主题的类型,虽然可以为 any,但这里是刻意进行限制以避免 “全局” 的发布订阅中心对象

Hierarchy

  • PubSubMachine

Index

Properties

Methods

Properties

Private subMap

subMap: Map<T, Function[]> = new Map<T, Function[]>()

订阅者集合

Methods

pub

  • pub(topic: any, ...args: any[]): void

sub

  • sub(topic: any, fn: Function): void

unsub

  • unsub(topic: any, fn?: Function): void

Generated using TypeDoc