A trouble with cc.systemEvent. v3.3.2

Hello!
In v2.4.0 i could do that:

onLoad() {
  cc.systemEvent.on('custom-event', () => {
    console.log('Something')
  })
  cc.systemEvent.emit('custom-event')
}

And it worked.

In v3.3.2 it does not work.

onLoad() {
  systemEvent.on('custom-event', () => {
      console.log('Something')
  })
  systemEvent.emit('custom-event')
}

How can i create and emit a custom system event?

1 Like

Solution:

onLoad() {
  systemEvent.on('custom-event' as any, () => {
      console.log('Something')
  })
  systemEvent.emit('custom-event')
}
onLoad() {
  systemEvent.on('custom-event' as any, (str: string) => {
      console.log(str)
  })
  systemEvent.emit('custom-event', 'Something')
}
1 Like