添加暂停可暂时禁用点击次数

时间:2016-12-12 18:51:51

标签: javascript events pause

我正在制作一个快速的剧本,以揭示我女朋友的礼物,我无法亲自送达。我希望在点击之间添加暂停,这样她就不会在一秒钟内意外地完成所有案例。

import org.apache.spark.sql.{SparkSession, SQLContext}
val ss = SparkSession.builder().appName("test").getOrCreate()
val dataDf = ...

import ss.sqlContext.implicits._
dataDf.filter(not($"column_name1" === "condition"))

2 个答案:

答案 0 :(得分:1)

您可以使用printf("2^%d * 3^%d * 5^%d * 7^%d * 11^%d",array[0],array[1],array[2],array[3],array[4])来切换点击处理程序:

setTimeout
const PAUSE_DURATION = 2000 // 2 seconds

const gifty = document.getElementById('gift')
const header = document.getElementById('head2')
const setText = text => header.innerHTML = text

let counter = 4

const handler = () => {        
  counter -= 1
  
  switch (counter) {
    case 3: setText('Click it again! Click it again!  '); break
    case 2: setText('Hmmm, what could it be?  '); break
    case 1: setText('Any ideas what it could be?  '); break
    case 0: setText('Surprise! Your new sewing machine is waiting for you in Doha! Hope you like it.  '); break
  }
  
  removeClickHandler()
  
  setTimeout(() => addClickHandler(), PAUSE_DURATION)
}

const addClickHandler = () => gifty.addEventListener('click', handler)
const removeClickHandler = () => gifty.removeEventListener('click', handler)

addClickHandler()

答案 1 :(得分:1)

var initialTime = new Date().getTime();

var handler = function() {
    var clickTime = newDate().getTime();
    if (clickTime - initialTime > 1000) { // 1 second

         (... do your stuff here ...)

       initialTime = new Date().getTime();
    }
}