Skip to content

STEVEOO6/queue-js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

queue-js: queue

JS step based procedural execution tool. Use this when you need to wait for something to be available on your page before executing something else

Syntax

queue(step1, step2[, step3, .., stepN])

Parameters

step1 Function that returns true or false. It will be called multple times until it returns true, or the limit of calls is made. step2 Function that returns true or false. Same as step1. To run this once, return true at the bottom of the function.

Usage

Use the queue.min.js file, copy and paste the code for var queue. queue.exists is an optional addon.

Example

queue(function(){
  //step 1
  return jQuery && jQuery("#button");
}, function(){
  jQuery("#button").on("click", function(){ 
     console.log("Clicked");
  });
  // Always return true on the last step, otherwise this will be called multiple times
  return true;
});

queue-js: queue.exists

Checks if something exists, based on brototype.doYouEven() [https://github.com/letsgetrandy/brototype]

Syntax

queue.exists(varToCheck)

Parameters

varToCheck A string using dot notation that describes a variable somewhere in JS land

Usage

Copy the queue.exists function from queue.min.js

Example

queue(function(){
  //step 1
  return queue.exists("CT.ABE.Step1.Reservation.Cloud.prototype.OnSuccess");
}, function(){
  window.mySuccess = CT.ABE.Step1.Reservation.Cloud.prototype.OnSuccess;
  return true;
});

About

JS step based procedural execution tool. Use this when you need to wait for something to be available on your page before executing something else

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%