Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SystemEvent

The System event, it currently supports keyboard events and accelerometer events.
You can get the SystemEvent instance with systemEvent.

example
import { systemEvent, SystemEvent } from 'cc';
systemEvent.on(SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
systemEvent.off(SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);

Hierarchy

  • any
    • SystemEvent

Index

Constructors

constructor

Properties

Static EventType

EventType: SystemEventType = SystemEventType

Methods

off

  • off(type: string, callback?: undefined | ((...any: any[]) => void), target?: any): void
  • Removes the listeners previously registered with the same type, callback, target and or useCapture, if only type is passed as parameter, all listeners registered with that type will be removed.

    Parameters

    • type: string

      A string representing the event type being removed.

    • Optional callback: undefined | ((...any: any[]) => void)

      The callback to remove.

    • Optional target: any

      The target (this object) to invoke the callback, if it's not given, only callback without target will be removed

    Returns void

on

setAccelerometerEnabled

  • setAccelerometerEnabled(isEnabled: boolean): void

setAccelerometerInterval

  • setAccelerometerInterval(interval: number): void

Generated using TypeDoc