— React-Native Programmierer . Patrick Tresp

Javascript setTimeout and Parameters call

Whithout writing too much about it for today, the best way ( i can always only speak for myself ) to call a function with setTimeout in JavaScript is:


var myTimeout = 400;
setTimeout(function(){ callFunction(parameter[s]) }, myTimeout);

function callFunction( parameter[s] )
{
// Do some Stuff here with the parameter[s]
}

Especially when a Parameter is a „multiple Word – String“ (e.g. „Hello Everyone, i am a multiple word String!“ ), using a „closure“ will be the way that works also in Internet Explorer 🙂

0 comments
Submit comment