0

How can I send the proactive message after 2 min of clicking on GetStarted button in facebook

async function getstartedinterval(dialogContext)
{


  timeoutobj= setTimeout(function (dialogContext) {
      console.log('--- inside setTimeout----',dialogContext);// displaying as undefined 
      notificationMsgGetStarted(dialogContext); 
  },constant.timeinterval);


}

I have tried with SetTimeOut but DialogContext is not accessible in this function. Please suggest .

Anil
  • 69
  • 7
  • setTimeout doesn't pass variables to the callback function by default. Try `setTimeout((param1, param2) => console.log(param1, param2), ms, param1, param2);` – tdurnford Sep 16 '19 at 21:26
  • Take a look at this StackOverflow question https://stackoverflow.com/questions/1190642/how-can-i-pass-a-parameter-to-a-settimeout-callback – tdurnford Sep 16 '19 at 21:27
  • Thanks for your suggestion. I tried but its not working. Hence, I used delay npm package. some how my requirement completed through that package. thanks. – Anil Sep 17 '19 at 20:42
  • it has been resolved using delay npm package. thanks. – Anil Sep 18 '19 at 18:33

0 Answers0