Constructor
new Joystick(params)
Example
// 如果是通过 Script 标签引入
const j = new CloudGamingPlugin.joystick({
 zone: document.querySelector('#plugin-point'),
});
// 如果是通过 ES module import
const j = new Joystick({zone: document.querySelector('#plugin-point')})Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| params | Object | Properties
 | 
Methods
on(type, handler) → {void}
监听摇杆事件
Parameters:
| Name | Type | Description | 
|---|---|---|
| type | Joystick~JoystickEventTypes | 监听事件 | 
| handler | Joystick~JoystickOutputData | 回调函数 response data 为 JoystickOutputData | 
Returns:
- Type
- void
destroy() → {void}
销毁
Returns:
- Type
- void
Type Definitions
JoystickEventTypes
摇杆事件类型
Type:
- 'start' | 'move' | 'end' | 'added'
JoystickOutputData(data)
摇杆回调数据结构
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| data | Object | Properties
 |