react fake double , bind click and dblclick on the same element
2016-05-23 15:57
375 查看
smartClick:function(id,name,waiter,e){ var desk = $$(e.currentTarget).data('raw'); if(this.lastClickTime[id] && ((new Date())-this.lastClickTime[id])>70) {//quick click twice , it seems a dblclick console.log('dblclick'); this.lastClickTime[id]=undefined; this.clickHandler && clearTimeout(this.clickHandler); this.clickHandler = 0; return; } if(!this.clickHandler) { this.clickHandler=setTimeout(function(){ console.log('click'); this.lastClickTime[id]=undefined; clearTimeout(this.clickHandler); this.clickHandler = 0; }.bind(this),300); this.lastClickTime[id]=new Date(); } return; },
相关文章推荐
- React Native项目修改包名(Android版)
- React Native初认识
- react native android
- React入门实践之TodoList: 添加事件和搜索框
- ReactiveCocoa之RAC常用宏(十)
- ReactiveCocoa之RAC合并(九)
- ReactiveCocoa之RAC过滤(八)
- ReactiveCocoa之RAC映射(七)
- ReactiveCocoa之RACMulticastConnection使用(六)
- ReactiveCocoa之RACCommand使用(五)
- ReactiveCocoa之RACSubject用法(四)
- ReactiveCocoa之RACSignal核心类的使用(三)
- ReactiveCocoa之常见用法(二)
- React-native debug errors
- 离线安装Chrome扩展程序
- ReactiveCocoa之简介(一)
- 响应式编程框架ReactiveCocoa学习——框架概览
- React Native学习笔记(二)JSX 语法学习
- Reacting to rumors
- React Native 安装开发环境及如何编写Hello World程序