Deferrable
A system for abusing callbacks.
Background
An ordinary Node-style long-running function looks something like this:
{ ...}
When that process is done, cb
is fired off, with an error
and a data
parameter. However, this often means we end up with spaghetti code that looks something like this:
Group;
It would be much nicer if we could get to that end goal without all the middle-men callbacks getting in the way, like this:
Group;
Usage
We can achieve this by marking our methods as deferrable
, and providing a prototype for the expected return value:
const deferrable = ; GroupfromId = ;