/**
 * 获取全局的class前缀
 */ export const classPrefix = 'rwp' ; let singleClickNumber = 0 ; let lastClickDate = null ; const clean = ( ) => { singleClickNumber = 0 ; lastClickDate = null ; } ; let beforeIdx ; param key export const toDoubleClick = ( callback , idx ? ) => { if ( idx === beforeIdx || beforeIdx === undefined ) { singleClickNumber += 1 ; if ( lastClickDate !== null && singleClickNumber > 1 && new Date ( ) . getTime ( ) - lastClickDate . getTime ( ) < 500 ) { callback ( ) ; clean ( ) ; } lastClickDate = new Date ( ) ; } else { singleClickNumber = 1 ; lastClickDate = new Date ( ) ; } beforeIdx = idx ; } ; /**
 * 判断是否是Promise对象
 * source https://github.com/then/is-promise/blob/master/index.js
 */ export const isPromise = ( obj ) => { return ! ! obj && ( typeof obj === 'object' || typeof obj === 'function' ) && typeof obj . then === 'function' ; } ;