Appearance
Class: EventSystem
用于事件监听
该组件应该是一个全局组件
应该要挂载到跟节点
用于获取和派发全局事件
点击穿透
点击冒泡
Hierarchy
EventEmitter
↳
EventSystem
Table of contents
Constructors
Properties
Methods
- addEvents
- addListener
- emit
- eventNames
- listenerCount
- listeners
- off
- on
- onBeagin
- onEnd
- onMove
- once
- removeAllListeners
- removeListener
- tapEmit
Constructors
constructor
• new EventSystem(transform
)
Parameters
Name | Type |
---|---|
transform | Transform <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
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
fn | (...args : any []) => void |
context? | any |
Returns
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
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
...args | any [] |
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
Name | Type |
---|---|
event | string | 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
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
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
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
fn? | (...args : any []) => void |
context? | any |
once? | boolean |
Returns
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
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
fn | (...args : any []) => void |
context? | any |
Returns
Inherited from
EE.on
Defined in
node_modules/eventemitter3/index.d.ts:40
onBeagin
▸ onBeagin(event
): void
Parameters
Name | Type |
---|---|
event | Vector2 |
Returns
void
Defined in
src/core/system/EventSystem.ts:31
onEnd
▸ onEnd(event
): void
Parameters
Name | Type |
---|---|
event | Vector2 |
Returns
void
Defined in
src/core/system/EventSystem.ts:35
onMove
▸ onMove(event
): void
Parameters
Name | Type |
---|---|
event | Vector2 |
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
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
fn | (...args : any []) => void |
context? | any |
Returns
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
Name | Type |
---|---|
event? | string | symbol |
Returns
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
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
fn? | (...args : any []) => void |
context? | any |
once? | boolean |
Returns
Inherited from
EE.removeListener
Defined in
node_modules/eventemitter3/index.d.ts:63
tapEmit
▸ tapEmit(transform
, eventName
): boolean
发送点击事件到正确的节点
Parameters
Name | Type |
---|---|
transform | Transform <Container > |
eventName | TouchEvent |
Returns
boolean