Skip to content
On this page

Class: EventSystem

用于事件监听
该组件应该是一个全局组件
应该要挂载到跟节点
用于获取和派发全局事件

点击穿透
点击冒泡

Hierarchy

  • EventEmitter

    EventSystem

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new EventSystem(transform)

Parameters

NameType
transformTransform<Container>

Overrides

EE.constructor

Defined in

src/core/system/EventSystem.ts:17

Properties

point

point: Vector2

Defined in

src/core/system/EventSystem.ts:29


transform

transform: Transform<Container>

Defined in

src/core/system/EventSystem.ts:17


prefixed

Static prefixed: string | boolean

Inherited from

EE.prefixed

Defined in

node_modules/eventemitter3/index.d.ts:9

Methods

addEvents

addEvents(): void

Returns

void

Defined in

src/core/system/EventSystem.ts:22


addListener

addListener<T>(event, fn, context?): EventSystem

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT
fn(...args: any[]) => void
context?any

Returns

EventSystem

Inherited from

EE.addListener

Defined in

node_modules/eventemitter3/index.d.ts:45


emit

emit<T>(event, ...args): boolean

Calls each of the listeners registered for a given event.

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT
...argsany[]

Returns

boolean

Inherited from

EE.emit

Defined in

node_modules/eventemitter3/index.d.ts:32


eventNames

eventNames(): (string | symbol)[]

Return an array listing the events for which the emitter has registered
listeners.

Returns

(string | symbol)[]

Inherited from

EE.eventNames

Defined in

node_modules/eventemitter3/index.d.ts:15


listenerCount

listenerCount(event): number

Return the number of listeners listening to a given event.

Parameters

NameType
eventstring | symbol

Returns

number

Inherited from

EE.listenerCount

Defined in

node_modules/eventemitter3/index.d.ts:27


listeners

listeners<T>(event): (...args: any[]) => void[]

Return the listeners registered for a given event.

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT

Returns

(...args: any[]) => void[]

Inherited from

EE.listeners

Defined in

node_modules/eventemitter3/index.d.ts:20


off

off<T>(event, fn?, context?, once?): EventSystem

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT
fn?(...args: any[]) => void
context?any
once?boolean

Returns

EventSystem

Inherited from

EE.off

Defined in

node_modules/eventemitter3/index.d.ts:69


on

on<T>(event, fn, context?): EventSystem

Add a listener for a given event.

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT
fn(...args: any[]) => void
context?any

Returns

EventSystem

Inherited from

EE.on

Defined in

node_modules/eventemitter3/index.d.ts:40


onBeagin

onBeagin(event): void

Parameters

NameType
eventVector2

Returns

void

Defined in

src/core/system/EventSystem.ts:31


onEnd

onEnd(event): void

Parameters

NameType
eventVector2

Returns

void

Defined in

src/core/system/EventSystem.ts:35


onMove

onMove(event): void

Parameters

NameType
eventVector2

Returns

void

Defined in

src/core/system/EventSystem.ts:39


once

once<T>(event, fn, context?): EventSystem

Add a one-time listener for a given event.

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT
fn(...args: any[]) => void
context?any

Returns

EventSystem

Inherited from

EE.once

Defined in

node_modules/eventemitter3/index.d.ts:54


removeAllListeners

removeAllListeners(event?): EventSystem

Remove all listeners, or those of the specified event.

Parameters

NameType
event?string | symbol

Returns

EventSystem

Inherited from

EE.removeAllListeners

Defined in

node_modules/eventemitter3/index.d.ts:79


removeListener

removeListener<T>(event, fn?, context?, once?): EventSystem

Remove the listeners of a given event.

Type parameters

NameType
Textends string | symbol

Parameters

NameType
eventT
fn?(...args: any[]) => void
context?any
once?boolean

Returns

EventSystem

Inherited from

EE.removeListener

Defined in

node_modules/eventemitter3/index.d.ts:63


tapEmit

tapEmit(transform, eventName): boolean

发送点击事件到正确的节点

Parameters

NameType
transformTransform<Container>
eventNameTouchEvent

Returns

boolean

Defined in

src/core/system/EventSystem.ts:59