by
27
8
203k
1
Top 1% !
Popular
Pearl of Wisdom
Nice
Useful
Easy-to-find
Specified
MultiPlatform
Popularity: 7900th place
Languagejavascript
LicenseMIT_X11

kWetntz.js ...  next in line please...

sequential async execution...  NEXT!!!     *** idk if this even werks, havent tried yet! ***
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/358431/kWetntz-js------next-in-line-please---?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
// sequential execution.... var kWentz = (function() { var roster = {}, lastTime = {}, slf = this, signal = function(name, arg) { var idx=0, kall = {}; if(roster[name]) { for(idx; kall=roster[name][idx]; idx++) { kall(arg); } } }, receive = function(name, receiver) { if(!roster[name]) { roster[name] = []; } roster[name].push(receiver); return slf; }, drop = function(name, receiver) { if(roster[name]) { var lst = [], kall = {}, idx = 0; for(idx; kall=roster[name][idx]; idx++) { if(kall !== receiver) { lst.push(kall); } } roster[name] = lst; } return slf; }, exec = function() { if(arguments.length > 0) { var cbks = [], kall = {}, elm = {}, idx = 0; for(idx; kall=arguments[idx]; idx++) { cbks.push(kall); } elm = cbks.shift(); if(typeof elm === 'function') { elm(lastTime, function(dta) { lastTime = dta; exec.apply(slf, cbks); }); } else if(typeof elm === 'object' && elm.length > 0) { var kall = elm.shift(), callBK = function(dta) { lastTime = dta; exec.apply(slf, cbks); }; kall.apply(kall, elm.concat([callBK])); } } else { signal("done", lastTime); } return slf; }; return { execute: exec, receive: receive, drop: drop }; })();
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus