| 12345678910111213141516 |
- /** 语句:scroll 滚动 */
- const types = ['scroll']
- function parse(action, parseContext) {
- return Object.assign({}, action, { type: 'scroll' })
- }
- async function execute(action, ctx) {
- const { device, resolution, api, calculateSwipeCoordinates, DEFAULT_SCROLL_DISTANCE = 100 } = ctx
- if (!api.sendScroll) return { success: false, error: '滚动 API 不可用' }
- const r = await api.sendScroll(device, action.value, resolution.width, resolution.height, DEFAULT_SCROLL_DISTANCE, 500)
- if (!r.success) return { success: false, error: `滚动失败: ${r.error}` }
- return { success: true }
- }
- module.exports = { types, parse, execute }
|