Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery deferred

function timeout(milliseconds) {
  // Create a new Deferred object
  var deferred = $.Deferred();

  // Resolve the Deferred after the amount of time specified by milliseconds
  setTimeout(deferred.resolve, milliseconds);

  // Return the Deferred's Promise object
  return deferred.promise();
}

timeout(1000).then(function() {
  console.log('I waited for 1 second!');
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: angular async 
Javascript :: angularjs - controllerAs 
Javascript :: how to flatten array in javascript using foreach loop 
Javascript :: switch new date getday javascript 
Javascript :: how to make data toggle=modal always active 
Javascript :: javaScript getMonth() Method 
Javascript :: convert image url to base64 javascript without canvas 
Javascript :: error handling in node js 
Javascript :: react usecallback hook 
Javascript :: like dislike node js 
Javascript :: best way to setup nextjs project 
Javascript :: react multiple classname 
Javascript :: fetcher for swr 
Javascript :: react native ant design 
Javascript :: react spread operator 
Javascript :: split() js 
Javascript :: js detect mouse support 
Javascript :: get latlong of address in here map api javascript 
Javascript :: js pass data between pages 
Javascript :: javascript get first element of array 
Javascript :: map in javascript 
Javascript :: ng-true-value 
Javascript :: props in classes 
Javascript :: process.env type 
Javascript :: mobile nav react npm 
Javascript :: call a javascript function at a specific time of day 
Javascript :: mdn getcurrentposition 
Javascript :: eslint stop compliant import from node_modules 
Javascript :: javascript custom modal 
Javascript :: check property exists in object javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =