Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SystemEvent

系统事件,它目前支持按键事件和重力感应事件。
你可以通过 systemEvent 获取到 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
  • 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 type,将会删除 type 类型的所有事件监听器。

    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