diff --git a/README.md b/README.md index 5fb5961..4cf1696 100644 --- a/README.md +++ b/README.md @@ -142,33 +142,6 @@ cordova.plugins.ShutoApi.addEventListener('uploadLog', function(_, callback) { // 监听待办事项同步事件(需要回调) cordova.plugins.ShutoApi.addEventListener('syncTodo', function(userInfo) { console.log('触发待办事项同步:', userInfo); - - // 模拟异步同步待办事项(使用 setTimeout 模拟网络延迟) - setTimeout(function() { - try { - // 模拟从服务器获取待办事项数据 - var todoList = [ - { id: 1, title: '完成项目文档', completed: false, priority: 'high' }, - { id: 2, title: '参加团队会议', completed: true, priority: 'medium' }, - { id: 3, title: '代码审查', completed: false, priority: 'high' } - ]; - - var syncResult = { - success: true, - syncedAt: new Date().toISOString(), - userId: userInfo.userId, - todoList: todoList, - totalCount: todoList.length, - completedCount: todoList.filter(function(todo) { return todo.completed; }).length - }; - - console.log('待办事项同步成功:', syncResult); - } catch (error) { - console.error('待办事项同步失败:', error.message); - // 返回错误信息 - callback(null, error.message); - } - }, 1000); // 模拟 1 秒的网络延迟 }); ```