Skip to content

Instantly share code, notes, and snippets.

View alano999's full-sized avatar

Alan O alano999

  • Wiltshire, UK
View GitHub Profile
@Fordi
Fordi / workflow-demo.js
Created January 31, 2012 23:41
Javascript Workflow Processor
(function () {
var sayHi = function (token) {
if (!token.progress) token.progress = {};
token.progress.saidHi = (token.progress.saidHi||0) + 1;
//true == simply proceed; false == reject workflow
return true;
},
shakeIt = function (token, next) {
token.progress.shook = (token.progress.shook||0) + 1;
next('right');
@dsc
dsc / chain.js
Created March 22, 2010 00:34
Async chained callback pattern.
(function(){
/**
* Function.asyncChain( fn, [...] ) -> Function
*
* Takes any number of callback functions and returns a scheduler function
* which manages the chain. Each supplied callback to should take one
* argument, the scheduler, to execute with no arguments when it completes.
*
* Example: