Skip to content

Instantly share code, notes, and snippets.

View ItsAsbreuk's full-sized avatar

Marco Asbreuk ItsAsbreuk

View GitHub Profile
@ItsAsbreuk
ItsAsbreuk / gist:6676361
Last active December 23, 2015 18:29 — forked from lsmith/gist:6664382
/*global SM:true*/
'use strict';
// Publish a very special, promise-compatible event that supports the default
// function behavior to chain on internally created promises before executing
// the after() subs. on() subs can still e.preventDefault(), which will
// reject the promise and thus skip the default behavior and after() subs.
var asyncEvent = eventTarget.publish('foo');
asyncEvent._firing = new Y.Promise(function (resolve) { resolve(); });
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>DT Destroy</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body class="yui3-skin-sam">
<button id="btnRebuild">Rebuild it!</button>
<div>build times: <span id="count"></span></div>
/**
* Example reading multiple databaserequests simultaniously
* while calling the callback-Fn only when all request have finished
*
* In this example, we want to read a table with all area's in a specific country.
* From there on, from every area we need to know the citienames and population, which resides in a second table.
*
* In some situations, this might be done with one statement using INNER JOIN, but there are cases where you need multiple requests. (performance or limitation)
*
* The array is build, has this form: